Left recursion and left factoring are two important concepts in compiler design and more specifically for context-free grammars and parsing. Left recursion can be problematic for top-down parsing and needs to be eliminated. Left factoring, on the other hand, improves the efficiency of top-down pa...
A new method for handling the left-recursions for top-down parsing is presented. This method preserves the structure of the parse tree specified by the given grammar. Besides, the parsers written based on this method are usually smaller than the parsers written based on the traditional method....
Left recursion naturally produces left associativity, and right recursion naturally produces right associativity. In some cases, the order of evaluation makes a difference. Consider the abstract syntax trees (asts) for the two five-element lists, shown in Figures 3.28e and 3.28f. The left-recursive...