Which of the following option is correct regarding bottom – up parsing?
(A) Every LR(0) grammar is SLR(1) and and converse is also true
(B) Every LALR(1) grammar is CLR(1) but every CLR(1) grammar may not be LALR(1)
(C) Number of states in SLR(1) < number of states in LALR(1) < number of states in CLR(1)
(D) None of these
Answer: (B)
Explanation:
- Every LR(0) is SLR(1) but Every SLR(1) may not be LR(0).
- Every LALR(1) grammar is CLR(1) but every CLR(1) grammar may not be LALR(1).
- Number of states in SLR(1) = number of states in LALR(1) ≤ number of states in CLR(1).
Refer – SLR, CLR and LALR Parsers
So, option (D) is correct.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...