Which of the following is true while converting CFG to LL(1) grammar?
2012
Which of the following is true while converting CFG to LL(1) grammar?
- A.
Remove left recursion alone
- B.
Factoring grammar alone
- C.
Both of the above
- D.
None of the above
Attempted by 68 students.
Show answer & explanation
Correct answer: D
To convert a Context-Free Grammar (CFG) to LL(1), two main steps are required. First, left recursion must be removed to prevent infinite loops during parsing. Second, the grammar must be factored to eliminate ambiguity and ensure unique production selection based on lookahead symbols. Both conditions are necessary for the grammar to be LL(1) compatible.
A video solution is available for this question — log in and enroll to watch it.