Library

DFA · Regular

A keyword: if, in, int or for

A finite set of words is a trie, and a trie is a DFA. Minimising it merges every word’s ending into one state, since nothing can follow any of them — but in keeps its own, because int continues it.

startififinfoiffnotr
The machine as drawn — 6 states, 7 transitions.Every word up to length 3, one row per length in shortlex order, inked where it is accepted.

The author’s examples, run

if → acceptin → acceptint → acceptfor → accepti → rejectfo → rejectinf → rejectinto → reject