You are on page 1of 2

THOMPSON'S CONSTRUCTION

(CONSTRUCTION OF NFA FROM REGULAR EXPRESSION)

1.epsilon(e)

e
-->(1)(s)--------->(2)(f)

2.terminal(r)

r
-->(1)(s)---------->(2)(f)

3.r1+r2(or)

e e
|----->((nfa for r1)-->(f1))---->---|
| |
-> (1)(s)---> ----->(2)(f)
| e e |
|----->((nfa for r2)-->(f2))---->---|

4.r1.r2

e e e
---->(1)(s) ---->{(nfa for r1)(s1)----->(f1)}----->{(nfa for r2)(s2)-->(f2)}----->(2)(f)
5.r1*

e
|<------<----<--<----<|
e | e |
--->(1)(s)---->{(nfa for r1)(s)---->(f)}-------->(2)(f)
| |
| |
| e |
| --->---->------>------->----->------->--->--|

hence we can contruct the nfa for a regular expression following the above construction
method for any regular expression given.

You might also like