CSC 372 - Systems II: Compiler Construction
Dr. R. M. Siegfried
Assignment #1 - Regular Expressions and Finite Automata
Due Thursday, February 8, 2007
2.1
For each of the following finite-state machines, draw its state diagram,
trace its operation on each of the strings shown and indicate which of them
are accepted:
a. Strings:
- aaaaa
- bbbbb
- ababa
- babab
- abbbb
b. Strings:
- abbab
- babba
- abbaa
- bbaab
- abaaa
c. Strings:
- abc
- bcacba
- ccca
- cbabc
- b
- bbbb
| a | b | c |
1 | 2 | 2 | 1 |
2 | 1 | 3 | 4 |
3 | 2 | 4 | 1 |
4 | 3 | 3 | 2 |
2.2
For each of the following NFAs, draw the state diagram,
trace its operation on each of the strings shown and indicate which of them
are accepted:
a. Strings:
- aaab
- baaab
- ababab
- baabb
- aba
| a | b |
1 | {1, 2} | {3} |
2 | {1} | {2, 3} |
3 | {1, 2} | {1} |
b. Strings:
- abaab
- baabb
- bbaba
- aabb
- bababa
- abbb
| a | b |
<epsilon> |
1 | {1} | {3} | {4} |
2 | {2} | {1} | { } |
3 | {1} | {4} | {2} |
4 | {3} | {2} | { } |
c. Strings:
- abaabc
- bacabb
- cbaba
- ccaacc
- babcb
| a | b | c |
<epsilon> |
1 | {1, 2} | {2} | {1, 3} | { } |
2 | {3} | {2, 3} | {1} | {4} |
3 | {3, 4} | {2} | {2, 4} |
{1} |
4 | {1} | {2} | {3} | { } |
2.13
Construct an NFA that recognizes the regular expression a|b* and find the
equivalent DFA.
2.14
Construct an NFA that recognizes the regular expression a(a | bc)*
and find the equivalent DFA.
[Back to the Assignments Index]