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

Consider the following translation scheme.
SER
RE {print ('*'); R|ε
EF+E {print ('+'); |F}
F(S)|id {print (id. value);]

Here id is a token that represents an integer and id. value represents the corresponding integer value. For an input '2 * 3 + 4', this translation scheme prints

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

The correct option is D 2 3 4 + *

So an input 2 * 3 + 4, it prints from the above parse tree as 2 3 4 + *.

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Transpose of a Matrix
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon