Discussion
Which of the following statements is/are true?
Answer: C
The true statement is For a grammar to be LL(1), it must be left-factored.
An LL(1) parser chooses a production by looking at one input symbol. If two alternatives of a non-terminal begin with the same prefix, their FIRST sets overlap and one symbol of lookahead cannot choose between them, so the grammar is not LL(1). Left factoring removes such common prefixes.
The other statements are false. An LL(1) parser is predictive and never backtracks. Left recursion is forbidden, not required, because it sends a top-down parser into an endless loop. And LL(1) parsers are not more powerful than SLR parsers: left-recursive grammars such as the usual expression grammar are SLR(1) but cannot be LL(1).
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development