Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?

2014

Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?

  1. A.

    Removing left recursion alone

  2. B.

    Removing the grammar alone

  3. C.

    Removing left recursion and factoring the grammar

  4. D.

    None of the above

Attempted by 66 students.

Show answer & explanation

Correct answer: D

It is theoretically impossible to convert every arbitrary Context-Free Grammar into an LL(1) grammar. While techniques like eliminating left recursion and factoring improve parsing, some context-free languages are inherently non-LL(1). Therefore, no set of operations guarantees an LL(1) grammar for all cases.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor