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?
- A.
Removing left recursion alone
- B.
Removing the grammar alone
- C.
Removing left recursion and factoring the grammar
- 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.