← 🔤 Lexical Analysis
Subtopic 2 of 6

2.2Regular expression → NFA (Thompson)

Build ε-NFAs for each symbol and combine with union, concatenation and star. Every fragment has exactly one start and one accept state.

NFA states14
Transitions16
ε-transitions11
Start / accept6 / 13
fromonto
0a1
2b3
4ε0
4ε2
1ε5
3ε5
6ε4
6ε7
5ε4
5ε7
8a9
7ε8
10b11
9ε10
12b13
11ε12

Thompson: each symbol makes 2 states; each | or * adds 2 more; concatenation adds none. So states ≤ 2 × (symbols + operators).

Previous year questions: Lexical Analysis (2)

PYQs are grouped by topic, so this is the full set for Lexical Analysis; try the ones that match this subtopic. Open all 2 on the topic page.