The following grammar is: S → Aa | bAc | dc | bda A → a

2020

The following grammar is:

S → Aa | bAc | dc | bda
A → a

  1. A.

    Neither LALR(1) nor SLR(1)

  2. B.

    LALR(1) but not SLR(1)

  3. C.

    Not LALR(1) but SLR(1)

  4. D.

    LALR(1) and SLR(1)

Attempted by 39 students.

Show answer & explanation

Correct answer: B

The correct option is B. The grammar is LALR(1) but not SLR(1). In the LR(0) collection, a state reached after processing prefix 'b' contains a Reduce-Reduce conflict for SLR(1) because Follow(A) = {a, c}, which intersects with the lookahead requirements. LALR(1) resolves this conflict by tracking specific context lookaheads.

Explore the full course: Niacl Ao It Specialist