wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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, n2 and n3 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
n1n3n2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C n1=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)

So, n1=n3<n2.

flag
Suggest Corrections
thumbs-up
1
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
4 Sides and 1 Diagonal
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon