Which statement is true ?
Which statement is true ? Correct Answer Every SLR grammar is unambiguous but not every unambiguous grammar is SLR
The correct answer is option 3.
Key Points
- Canonical LR is the most powerful parser as compared to other LR parsers. Order: LR(0)< SLR < LALR < CLR. So, it is False.
- Here, LP Linear Precedence. Every grammar generated by LP is CFG but all CFG's are not LP. So, it is False.
- SLR grammar cannot be ambiguous but if any unambiguous grammar has shift-reduce conflict then it cannot be parsed with an SLR parser. True
- LR(k) has a k-look ahead which can always see ahead of the input in order to avoid backtracking. So, it is False.
∴ Hence the correct answer is Every SLR grammar is unambiguous but not every unambiguous grammar is SLR.
মোঃ আরিফুল ইসলাম
Feb 20, 2025