[Verse 1] When your regex builds an NFA maze Multiple paths through epsilon haze Time to tame this wild machine Convert it to a DFA clean Each new state holds a bundle tight Sets of old states burning bright [Chorus] Subset construction, that's the key Every DFA state's a family tree Epsilon closure starts the dance Union all the paths at once Two to the power n might explode But most stay hidden on this road [Verse 2] Begin with q-zero wrapped in care Epsilon closure takes you there For every symbol, every door Gather states and then explore Delta function calls unite Wrap in closure, seal it tight [Chorus] Subset construction, that's the key Every DFA state's a family tree Epsilon closure starts the dance Union all the paths at once Two to the power n might explode But most stay hidden on this road [Bridge] Accept if any member qualifies One final state means victory's prize Compilers use this ancient trick Regex to NFA so quick Then convert for matching speed Linear time is what we need [Verse 3] Exponential fear might paralyze But reachable states are the real prize Most combinations never wake Only useful paths we'll make From chaos comes a structured friend Deterministic till the end [Final Chorus] Subset construction saves the day Transforms the wild to tame display Epsilon closure, union strong This algorithm can't go wrong Theory meets the real world's call Automata conquers all
← 2 Nondeterministic Finite Automata (NFA) | 4 Regular Expressions →