You type =(B2+C2)*(D2-E2 into a spreadsheet and press Enter. A message pops up: the formula is wrong, a bracket is missing. The program did not guess. It checked that every ( has a ) waiting for it, and that the brackets close in the right order. Now think about how you would build that check. You would count: one more open bracket, two more, one fewer. And that is exactly what the machines of the last chapter cannot do. A finite automaton has a fixed number of states, decided before it sees any input, so a machine with ten states loses track when eleven brackets are open. You saw this happen when the pumping lemma knocked out 0ⁿ1ⁿ.
So we need stronger machines, and we need a stronger way of describing languages than a regular expression. This chapter climbs that ladder one step at a time. First a new notation, the grammar, which says in a few short rules how every legal string is built. Then a machine with a stack, which can count without limit. Then the full picture, the Chomsky hierarchy, where each kind of grammar is matched with its own kind of machine. At the top stands the Turing machine, which is a model of what any computer can ever do. And right at the end comes a surprise: a question that no machine, however clever, can answer.
By the end you will be able to write a grammar for a language, derive strings and draw parse trees, spot an ambiguous grammar and repair it, and clean a grammar up, put it in Chomsky normal form and remove its left recursion. You will design a pushdown automaton and trace it move by move, and say why aⁿbⁿcⁿ defeats it. You will place any language on the hierarchy, build Turing machines for standard exam languages and run them on paper, and explain the halting problem with its proof.