Syntax-directed Translation: GATE CS Previous Year Questions

Syntax-directed Translation · Compiler Design

17 questions · asked in 11 of 27 years (2000–2026)

MCQ 13 · MSQ 2 · NAT 21-mark 10 · 2-mark 7

2000Questions per year2026

Questions 11–15 of 17

Q11GATE 2016 (Session 1)2 marksMCQ−0.67 if wrong
Consider the following Syntax Directed Translation Scheme(SDTS),with non-terminals {S, A} and terminals {a, b}.
S →\rightarrow aA {print 1}
S →\rightarrow a { print 2}
A →\rightarrow Sb { print 3}
Using the above SDTS, the output printed by a bottom-up parser, for the input aab is:

Q12GATE 20061 markMCQ−0.33 if wrong
Consider the following translation scheme.
S →\rightarrow ER
R →\rightarrow* E{print('*');}R|ε\varepsilon
E→\rightarrowF+E{print('+');}|F
F→\rightarrow(S)|id{print(id.value);}
Here id is a taken that represents an integer and id.value represents the corresponding integer value. For an input '2*3+4', this translation scheme prints

Q13GATE 20041 markMCQ−0.33 if wrong
Consider the grammar rule E→E1−E2E \rightarrow E1 - E2 for arithmetic expressions. The code generated is targeted to a CPU having a single user register. The subtraction operation requires the first operand to be in the register. If E1 and E2 do not have nay-common sub-expression, in order to get the shortest possible code

Q14GATE 20031 markMCQ−0.33 if wrong
Which of the following statements is FALSE?

Q15GATE 20031 markMCQ−0.33 if wrong
In a bottom-up evaluation of a syntax directed definition, inherited attributes can

Keep practising

Topics in Compiler Design

All CS topics ›