GATEverse Practice, past papers & mock tests
GATE 2022
Compiler DesignParsing TechniqueshardNAT2 marks
Consider the following grammar along with translation rules. S → S1 # T { S.val = S1.val * T.val } S → T { S.val = T.val } T → T1 % R { T.val = T1.val / R.val } T → R { T.val = R.val } R → id { R.val = id.val } Here # and % are operators and id is a token that represents an integer and id.val represents the corresponding integer value. Using this translation scheme, the computed value of S.val for root of the parse tree for the expression 20#10%5#8%2%2 is _____________.
Save your progress

Related Compiler Design PYQs