Lexical analysis

Subset Construction

Convert an NFA to a DFA using ε-closures, one table row at a time.

  • Lecture reference: Lexical Analysis III · slides 14–16
  • Lecture reference: Lexical Analysis IV · slides 8–12

Source

Regular definitions
Tab inserts a tab. Press Escape, then Tab, to move focus out of the editor.

The NFA is built with Thompson's construction; its states are named A, B, C, … by column. Open in Thompson's construction

DFA state names
Lecture reference: Lexical Analysis IV · slide 11

Is the previous DFA minimal?

Show answer

No. ABCDHI and FGABCDHI are both non-accepting, and on every symbol they go to the same state (0 → FGABCDHI, 1 → EJGABCDHI), so they can be merged. The minimal DFA has 2 states.

Minimize this DFA

Construction

DFA states: — of 2¹⁰ = 1,024 possible subsets
NFA 10 states, Thompson's construction
DFA 3 of 3 states Minimize this DFA Open DFA in Finite Automata
ABCDEFGHIJ

Click states to pick a set; the order you pick them is the order the seeds are listed.

Set { }

The closure lists the picked states first, then each state reached by ε-edges, depth first, following ε-edges in the order they were made.