FINITE MACHINES. INFINITE POSSIBILITIES.
A regex, under the hood.
Build it. Reduce it. Follow every transition.
THOMPSON → SUBSET → MINIMAL
AN INTERACTIVE COMPILER EXPLORER
AN INTERACTIVE COMPILER EXPLORER
The smallest equivalent machine.
States with identical future behavior become one.
activeacceptingε = no input consumed
NFA STATES—
DFA STATES—
MINIMAL STATES—
COMPILER WORK—
Inspect a state
| ON INPUT | GO TO | CHARACTERS |
|---|
Compiling…
01 / THOMPSON CONSTRUCTION
Compose little machines.
Each syntax node becomes a fragment. Epsilon transitions connect them into a nondeterministic automaton.
02 / SUBSET CONSTRUCTION
Make every move certain.
Each DFA state represents a set of NFA states. Every character has exactly one destination, including a dead state when needed.
03 / PARTITION REFINEMENT
Keep only real distinctions.
Repeatedly split states with different futures. Equivalent states merge without changing the language the machine accepts.