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…
- A.
Both S1 and S2.
- B.
Neither S1 nor S2.
- C.
Only S1.
- 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).
Loading lesson…