Finite Automata-Topic RE to NFA
Finite Automata-Topic RE to NFA
LEXICAL ANALYSIS
• Structure of compiler
• Functions and Roles of lexical phase
• Input buffering
• Representation of tokens using regular expression
• Properties of regular expression
• Finite Automata
• Regular Expression to Finite Automata
• NFA to Minimized DFA.
• Assignments
Applications:
– Compliers
– Text processing
– Hardware design
start a b b
0 1 2 3
Transition Table
All DFA are derived from NFA. Not all NFA are DFA.
DFA requires more space. Requires less Space.
The next possible state is clearly Ambiguity occurs.
set.
• Start State
• Accepting State
• A transition label
DFA
Minimized DFA
Step 4: RE=ab
start a b a ε
OR start
0 1 2 0 1 2 b 3
start ε a ε
0 1 2 3
Step 6: RE= a+
= a.a*
Follow step 4 for construction.
a. (a|b)*abb
b. (a|b)*
c. (a*|b*)*
d. ((ε|a)b*)*
e. (0|123)*
r1 | r2 ε
a b
r11
r9 ε
r10
r7 a
r8 2 3
r5 b ε
ε
0ε 1
start a
r6 b ε 8
r4 6 7
*
a ε 4 5 ε
( r3 ) b
r1 | r2 ε
a b
a
2 3
ε
ε
start 0 ε 1
6 ε 7 a 8 b 9 b 10
ε
4 5 ε
b
a. (a|b)*abb
b. (a|b)*
c. aa*|bb*
d. ((ε|a)b*)*
e. (0|123)*