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

Consider the context-free grammar
EE+E
E(E * E)
Eid
where E is the starting symbol, the set of terminals is {id, (, + ,), *} and the set of non-terminals is {E}.

Which of the following terminal strings has more than one parse tree when parsed according to the above grammar?

A
id + (id* (id * id))
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
(id* (id * id)) + id
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
id + id + id + id
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
((id * id + id) * id)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C id + id + id + id

id + id+id+id has more than one parse tree.

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