Exercise 2 Name __________________
Score __/31
- (10) Write regular expressions for the following:
- Strings over the alphabet {a,b,c} where the first a precedes
the first b.
- Strings over the alphabet {a,b,c} with an even number of of a's.
- Binary numbers that are multiples of four.
- Strings over the alphabet {a,b,c} that don't contain the contiguous
substring baa.
- The language of non-negative integer constants in C, where numbers
beginning with O are octal constants and other numbers are decimal
constants.
- (1) Why are you not surprised that there is no regular expression
defining strings of a's and b's that are palindromes
(the same forward as backward). Hint: Consider the number of finite-automata
states required.
- (4) Explain in informal English what each of these finite-state automata
recognizes.

- (4) Convert these regular expressions to NFA.
- (if|then|else)
- (a((b|a)*c)x)*|x*a
- (12) Convert these NFAs to DFAs, just do a.
