4.1.2 Elimination of Left-Recursion

There is a formal technique for eliminating left-recursion from productions

Step One: Direct-Recursion

For each rule which contains a left-recursive option,

introduce a new nonterminal A' and rewrite the rule as

Thus the production:

is left-recursive with "E" playing the role of "A","+ T" playing the role of , and "T" playing the role of A'. Introducing the new nonterminal E', the production can be replaced by:

Of course, there may be more than one left-recursive part on the right-hand side. The general rule is to replace: