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

A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar

S xx W {print "1"}S y {print "2"}W Sz {print "3"}
What is the translation of xxxxyzz using the syntax directed translation scheme described by the above rules?

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

The correct option is C 23131
Syntax directed tree of xxxxyzz is as follows:

So translation by rules is 23131
[The code has translation rules at the end, so the result of top-down and bottom-up parsing will be same.]

flag
Suggest Corrections
thumbs-up
1
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