Assume that the SLR Parser for a grammar G has n1 states and the LALR Parser…

2025

Assume that the SLR Parser for a grammar G has n1 states and the LALR Parser for G has n2 states.

  1. A.

    n1 is necessarily less than n2

  2. B.

    n1 is necessarily equal to n2

  3. C.

    n1 is necessarily greater than n2

  4. D.

    None of the above

Attempted by 29 students.

Show answer & explanation

Correct answer: B

  • Number of states in SLR (n1) = Number of LR(0) states.

  • Number of states in LALR (n2) = Number of LR(0) states (after merging LR(1) states with identical cores).

  • Therefore, n1 = n2.

Correct Option: 2

Explore the full course: Mppsc Assistant Professor