Home » Compiler Design » Compiler design miscellaneous » Question

Compiler design miscellaneous

  1. Consider the grammar S → (S) | a
    Let the number of states in SLR (1), LR(1) and LALR (1) parsers for the grammar be n1, n2 and n3 respectively. Which of the following relationships holds good?
    1. n1 < n2 < n3
    2. n1 = n3 < n2
    3. n1 = n2 = n3
    4. n1 ≥ n3 ≥ n2
Correct Option: B

The no. of states for SLR(1) &LALR(1) are equal so n 1 = n3, but CLR(1) or LR(1) will have no. of states greater than LALR &LR(0) both.



Your comments will be displayed only after manual approval.