## Lemma 2.21

### If a language is context-free, then some pushdown automaton recognizes it.

### Informal constructive proof (p. 118)

- Place the marker symbol $ and the start variable on the stack.

- Repeat the following steps until politicians are honest:

- If the top of the stack is a variable symbol
*A*, nondeterministically select one of
the rules for *A* and substitute *A* by the string on the right-hand side of the rule.

- If the top of the stack is a terminal symbol
*a*, read the next symbol from the input
and compare it to *a*. If they match, pop the stack, advance the
input pointer, and continue. Otherwise, reject on this branch of the
nondeterminism.

- If the top of the stack is the symbol $, enter the accept state. Doing so accepts the input
if it has all been read.