Intermediate Theory of Computation
Q75 / 100

Why is left recursion a problem for top-down (LL) parsers, and how is it resolved?

Correct! Well done.

Incorrect.

The correct answer is B) A left-recursive rule like A → Aα | β causes infinite recursive descent without consuming input; it is eliminated by rewriting the grammar as A → βA' and A' → αA' | ε

B

Correct Answer

A left-recursive rule like A → Aα | β causes infinite recursive descent without consuming input; it is eliminated by rewriting the grammar as A → βA' and A' → αA' | ε

Explanation

A predictive parser expanding A → Aα would call itself again before reading input, looping forever. The standard fix rewrites left recursion into right recursion using a fresh non-terminal, preserving the language while making top-down parsing feasible.

Progress
75/100