Consider the statements. S1: Every LR(1) grammar must be unambiguous. S2:…

Consider the statements.

S1: Every LR(1) grammar must be unambiguous.

S2: Every unambiguous grammar must not be LR(1)

Which of the above statement is/are TRUE?

Answer: C. Only S1.Every LR(1) grammar must be unambiguous but every unambiguous grammar need not be LR(1). For example the grammar S-> aSa | bSb | ε is unambiguous but it is…

  1. A.

    Both S1 and S2.

  2. B.

    Neither S1 nor S2.

  3. C.

    Only S1.

  4. D.

    Only S2.

Attempted by 103 students.

Show answer & explanation

Correct answer: C

Every LR(1) grammar must be unambiguous but every unambiguous grammar need not be LR(1).

For example the grammar S-> aSa | bSb | ε is unambiguous but it is not LR(1).

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…