Chapter 1: The Generality Gambit
Every working programmer who has ever built a parser remembers the moment their elegant grammar was rejected by a parser generator. You wrote something beautiful, something that captured the essence of your language with clarity and precision. The rules were simple, direct, and mathematically clean. Left-recursive productions made operator associativity explicit. A few well-placed ambiguities reflected the genuine structural flexibility of the input.
You fed this grammar to your tool, expecting a working parser. Instead, you received error messages that made no sense to anyone but the tool's author: "shift-reduce conflict," "left recursion detected," "parser stack overflow."Your grammar was not wrong. Your parser generator was too weak.This is the Generality Gambit—the bet that language designers and computational linguists have been forced to make for decades. They gamble that their grammar will fit into the narrow confines of LL(k) or LR(k) parsing. They gamble that left-recursion can be eliminated without destroying readability.
They gamble that ambiguities can be resolved at parse time rather than during semantic analysis. When the gambit fails, they spend hours transforming grammars, inserting dummy non-terminals, and fighting with precedence declarations. The language they designed, the grammar they crafted with care, becomes unrecognizable.Jay Earley refused to accept this gambit. In 1968, as a graduate student at Carnegie Mellon University, he asked a radical question: why should the parser impose restrictions on the grammar? Why couldn't a parser handle any context-free grammar, directly and without transformation?
The algorithm he developed in his 1970 Ph D dissertation answers that question with a definitive "yes."This chapter establishes why…
This is the end of the free sample. Get the eBook to keep going. Buy now →





















