Consider the grammar S→(S)|a
Let the number of states in SLR (1), LR (1) and LALR (1) parsers for the grammar be n1,n2andn3 respectively. The following relationship holds good
A
n1=n2=n3
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
n1<n2<n3
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
n1=n3<n2
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
n1≥n3≥n2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution
The correct option is Cn1=n3<n2 S→(S)|a
Parser
Number of states
SLR (1)
n1
LR (1)
n2
LALR (1)
n3
The number of states of deterministic finite automate in SLR(1) and LALR(1) parsers are equal, so n1=n3. The number of states of deterministic finite automata in LR(1) is greater than number of states of deterministic finite automata of SLR(1) and LALR(1)