Why Left Recursion Breaks Top-Down Parsers and How to Eliminate It
Top-down parsers, including LL(1) and recursive descent designs, search for a leftmost derivation by choosing productions based on lookahead. A rule with left recursion causes a function to call itself before consuming any input, leading to infinite recursion and a stack overflow. The problem can be solved by rewriting the grammar with a new right-recursive non-terminal that generates the same language. The article also describes a systematic algorithm that removes indirect left recursion by reordering and substituting non-terminals before eliminating immediate cases. It notes, however, that removing left recursion does not fix ambiguity already present in a grammar.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in