Let a deterministic finite automaton recognizing the regular language have states , start state , accepting states , and transition function . Construct a context-free grammar with one nonterminal for every state, start symbol , and productions
Induction on the length of a word shows that derives exactly when the automaton reaches from after reading . The terminal production can then end the derivation precisely at an accepting state. Thus the grammar generates exactly the recognized language, proving every regular language is a context-free language. This is actually a right-linear grammar, a special case of a context-free grammar.