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

For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε is the empty string, $ indicates end of input, and | separates alternate right hand sides of productions.
Sa A b B | b A a B | ε
AS
BS

a b $
S E1 E2 Sε
A AS AS error
B BS BS E3

The FIRST and FOLLOW sets for the non-terminals A and B are

A
FIRST (A) = {a, b, $}
FIRST (B) = {a, b, ε}
FOLLOW (A) = {a, b}
FOLLOW (B) = {$}
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
FIRST (A) = {a, b, ε} = FIRST (B),
FOLLOW (A) = {a, b}
FOLLOW (B) = $
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
FIRST (A) = {a, b} = FIRST (B)
FOLLOW (A) = {a, b}
FOLLOW (B) = {a, b}
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
FIRST (A) = {a, b, ε} = FIRST (B),
FOLLOW (A) = {a, b}
FOLLOW (B) = {a, b, $}
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D FIRST (A) = {a, b, ε} = FIRST (B),
FOLLOW (A) = {a, b}
FOLLOW (B) = {a, b, $}
SaAbB|bAaB|ε
AS
BS
First of S = {a, b, ε}
First of A = {a, b, ε}
First of B = {a, b, ε}
Follow of S = {$,a,b}
Follow A = {b, a}
Follow of B = {$, a, b}

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