Computer Sciences > Gate 2017 Set-2 > Parsing
Which of the following statements about the parser is/are correct?

I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR.
III. SLR is more powerful than canonical LR.
A
I only
B
II only
C
III only
D
II and III only

Correct : P

Given:
Three statements about parsing power:
I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR.
III. SLR is more powerful than canonical LR.
To find:
Which of the statements is/are correct.
Solution:
Let me recall the hierarchy of power for bottom-up LR parsers.
The parsing power increases as follows:
LR(0) < SLR(1) < LALR(1) < CLR(1)<br>This means every SLR(1) grammar is an LALR(1) grammar, and every LALR(1) grammar is a CLR(1) grammar.
So CLR(1) is the most powerful among them, followed by LALR(1), then SLR(1), and LR(0) is the least powerful.
Now let's check statement I:
"Canonical LR is more powerful than SLR."
Since CLR(1) > SLR(1), this statement is correct.
Now checking statement II:
"SLR is more powerful than LALR."
Since LALR(1) is actually more powerful than SLR(1), this statement is false.
Now checking statement III:
"SLR is more powerful than canonical LR."
CLR(1) is more powerful than SLR(1), so this statement is also false.
Therefore, only statement I is correct.
Answer: (A) I only

Similar Questions

Which one of the following is True at any valid state in shift-reduce parsing?
#76 MCQ
Consider the augmented grammar given below: S′ → S S → ⏐id L → L, S⏐S Let I0= CLOSURE ({[S′ → S]}). The number of items in the set GOTO (I0,
#620 Fill in the Blanks
Consider the following context-free grammar where the start symbol is S and the set of terminals is {a,b,c,d}. The following is a partially-filled LL(1) par...
#928 MCQ

Related Topics

parser theory grammar parsing GATE computer science 2017 LR parser canonical LR vs SLR LALR parser grammar types parsing algorithms GATE set 2 question 5

Unique Visitor Count

Total Unique Visitors

Loading......