I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR.
III. SLR is more powerful than canonical LR.
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
Total Unique Visitors