
90 Compilers – Principles and Practice
4.3.2 Operator Precedence Parsing
Operator precedence parsing is a simple Bottom-up parsing method which can be used if the
grammar is expressed in a particular form, known as operator grammar. For such a grammar, a
Shift/Reduce kind of parser can be built using this technique.
Operator Grammar
First, we define the operator grammar.
Definition 4.3.1 (Operator Grammar) An operator grammar is the one in which no right-hand
side of any production contain two adjacent non-terminals.
For example, grammar G given above is not an operator grammar, because ID appears in one RHS.
On the other hand, the arithmetic ...