Which of the following statements are true about parsing in Compiler design?…
2025
Which of the following statements are true about parsing in Compiler design?
i. A parser converts tokens generated by the lexical analyser into a parse tree.
ii. A top-down parser can handle left-recursive grammars without any modifications.
iii. A shift-reduce parser can make decisions based on the current input symbol and the top of the stack.
iv. LL(1) parsing is a type of bottom-up parsing technique.
Choose the correct answer from the option given below.
- A.
Only i, ii
- B.
Only i, iii
- C.
Only ii, iv
- D.
Only i, iii, iv
Attempted by 63 students.
Show answer & explanation
Correct answer: B
Statement i is true because parsers convert lexical tokens into parse trees. Statement ii is false as top-down parsers cannot handle left recursion without modification, causing infinite loops.
Statement iii accurately describes shift-reduce parsing mechanics using the stack and input symbols. Finally, statement iv is incorrect because LL(1) is a top-down technique.
Therefore, statements i and iii are true, making option 1 the correct choice.