Multiple choice

Assume that the SLR parser for a grammar G has n1 states and the LALR parser for that grammar has n2 states. Which of the following statements about the relationship between n1 and n2 is true?

  1. n1 is necessarily less than n2.

  2. n1 is necessarily equal to n2.

  3. n1 is necessarily greater than n2.

  4. none of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

SLR parse has less range of context free languages than LALR, but still both n1 and n2 are the same for SLR and LALR, respectively.