Which of the following statements is/are correct? A. SLR parser is more powerful than LALR parser. B. Canonical LR parser is more powerful than LALR parser. C. LALR parser is more powerful than Canonical LR parser.

Which of the following statements is/are correct? A. SLR parser is more powerful than LALR parser. B. Canonical LR parser is more powerful than LALR parser. C. LALR parser is more powerful than Canonical LR parser. Correct Answer Only B

The correct answer is option 2.

Concept:

Statement A: SLR parser is more powerful than LALR parser.

False, LALR(1) parser is more powerful than SLR(1) and LR(0) parser. LALR offers a good solution, because LALR(1) grammars are more powerful than SLR(1), and can parse most practical LL(1) grammars. LR(1) grammars are more powerful than LALR(1).

[ alt="F1 Shraddha Harshita 25.02.2022 D19" src="//storage.googleapis.com/tb-img/production/22/02/F1_Shraddha_Harshita_25.02.2022_D19.png" style="width: 465px; height: 243px;">

Statement B: Canonical LR parser is more powerful than LALR parser.

True, Canonical LR parser is more powerful than LALR parser. The number of states in the parsing automaton differs between the CLR and LALR algorithms. CLR parsers have a much larger number of states than LALR parsers.

Statement C: LALR parser is more powerful than Canonical LR parser.

False, Canonical LR parser is more powerful than LALR parser. Canonical (CLR) is the most powerful Parsers among all the LR(k) Parsers or SLR.

Hence the correct answer is Only B.

Related Questions

Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states. Hence which one is true?
Assume that the SLR parser for a grammar G has n1 states and the LALR parser for G has n2 states.