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

Consider the following Syntax Directed Translation Scheme (SDTS), with non-terminals {S, A} and terminals {a, b}.

SaA {print 1}
Sa {print 2}
ASb {print 3}

Using the above SDTS, the output printed by a bottom-up parser, for the input aab is:

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

The correct option is A 2 3 1
Input is 'aab'

So tree for given input.


So output will be 2, 3 and 1 because printed order will be 1, 2, 3.
So output: 2 3 1

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