Definition
A finite automaton (FA) is an abstract machine with a finite number of states used to recognize strings belonging to a regular language — the mechanism that actually implements a regex in a lexer.
Key Points
Example
DFA for (a|b)*abb (strings ending in "abb") is a classic construction question: 4 states, where state 4 is the only accepting state, reached only after seeing exactly a,b,b in sequence.
📌 CSS Frequency: High — DFA construction for a given regex is one of the most repeated numeric questions.
Model Answer (short)
"By Kleene's Theorem, regular expressions, finite automata, and regular grammars are equivalent in expressive power — any regular expression can be converted to an NFA (Thompson's construction), then to an equivalent DFA (subset construction). A DFA has unique transitions per symbol, making it directly usable by a lexical analyzer, while an NFA is easier to construct but not directly executable."