1. (10 points)Write a finite automaton or a
Grammar for a language that accepts all words
starting with an alphabet character that is not
{for, while, if, int), words can contain
alphanumeric characters?
2. (10 points)What Would the regular expression
for the above problem be?
3. (30 points) For the following problems treat
'PrimaryExpr' as a TERMINAL SYMBOL:
a. Write the 5 smallest valid for loops in
GoLang
b. Write all switch statements in GoLang
that have 3,5 and 7 terminals
c. Write all if statements in GoLang that
have 3, and 4 terminals
4. (10 points) Draw a DFA that is defined by a
language L that contains all possible integer
literals in C
5. (10 points) Draw a DFA that is defined by a
language L that contains all possible floating-
point literals in C
6. (10 points) Draw a DFA that is defined by a
language L that contains all possible rune
literals in GoLang
7. (10 points) Draw and detail the compilation
process and state what mechanisms are used
by each phase to take in input and pass it to
the next phase
8. (5 points) What is the pattern form each type
of numerical literal this string can produce:
/\d+\.?\d*\.\d+/
a. (5 points) How would you rewrite it
without short cut key \d and +