A context-free grammar is in Chomsky normal form when every production rule has one of the forms
where are nonterminal symbols and is a terminal symbol. If the language contains the empty word, one may additionally permit , with the start symbol absent from all right-hand sides.
A context-free grammar is a quadruple consisting of a finite set of nonterminal symbols, a disjoint finite alphabet of terminal symbols, a start symbol , and a finite set of productions with and . A sentence is a terminal word over an alphabet with , and the generated formal language is .
The first language is context-free. For example, the productions
generate exactly : each recursive production adds two s to the left and two s to the right.