CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

The grammar SaSa |bS|c is

A
Both LL(1) and LR(1)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
LR(1) but not LL(1)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Neither LL(1) nor LR(1)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
LL(1) but not LR(1)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A Both LL(1) and LR(1)
SaSa |bS|c
The above grammar is LL(1) because,
First [aSa] first [bS]=(a)(b)=ϕ
&&
First [bs] first [c]=(b)(c)=ϕ
&&
First [c] first [aSa]=(c)(a)=ϕ

As the above grammar is LL(1), also LR(1) because LL(1) grammar is always LR(1) grammar.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Types of Sets
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon