 
Summary: 2 Contextfree Grammars and Pushdown Automata
As we have seen in Exercise 15, regular languages are not even sufficient to cover wellbalanced
brackets. In order even to treat the problem of parsing a program we have to consider more
powerful languages. Our aim in this section is to generalize the concept of a regular language
to cover this example (and others like it), and to find ways of describing such languages. The
analogue of a regular expression is a contextfree grammar while finite state machines are
generalized to pushdown automata. We establish the correspondence between the two and
then finish by describing the kinds of languages that are not captured by these more general
methods.
2.1 Contextfree grammars
The question of recognizing wellbalanced brackets is the same as that of dealing with nesting
to arbitrary depths, which certainly occurs in all programming languages. To cover these
examples we introduce the following definition.
Definition 11 A contextfree grammar is given by the following:
· an alphabet of terminal symbols, also called the object alphabet;
· an alphabet N of nonterminal symbols, the elements of which are also referred to as
auxiliary characters, placeholders or, in some books, variables, where N = ;7
· a special nonterminal symbol S N called the start symbol;
· a finite set of production rules, that is strings of the form R where R N is a non
terminal symbol and ( N) is an arbitrary string of terminal and nonterminal
