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:

ab
1 23
2 12
3 13

b. Strings:

ab
1 12
2 33
3 21

c. Strings:

abc
1 221
2 134
3 241
4332

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:

ab
1 {1, 2}{3}
2 {1}{2, 3}
3 {1, 2}{1}

b. Strings:

ab <epsilon>
1 {1}{3}{4}
2 {2}{1}{ }
3 {1}{4}{2}
4{3}{2}{ }

c. Strings:

abc <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]