Consider the following grammar along with translation rules.
\{S.val = S_1.val * T.val\}
\{S.val = T.val\}
\{T.val = T_1.val \div R.val\}
\{T.val = R.val\}
\{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. The set of non-terminals is and a subscripted non-terminal indicates an instance of the non-terminal.
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 __________.
GATE CS 2022 (Forenoon) — Question 65
Compiler DesignSyntax-Directed Translation & Runtime EnvironmentsNAT2 marksHard
A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.
More on Syntax-Directed Translation & Runtime Environments
- GATE CS 2026 (Forenoon) · Q53Consider the following two syntax-directed definitions SDD1 and SDD2 for type declarations. D is the start symbol, and int, float and id ar…
- GATE CS 2025 (Forenoon) · Q12Which ONE of the following statements is FALSE regarding the symbol table?
- GATE CS 2025 (Afternoon) · Q22Given the following syntax directed translation rules: Rule 1: R AB \ B.i = R.i - 1; A.i = B.i; R.i = A.i + 1;\ Rule 2: P CD \ P.i = C.i +…
- GATE CS 2024 (Forenoon) · Q37Consider the following syntax-directed definition (SDD). Given “MMLK” as the input, which one of the following options is the CORRECT value…
- GATE CS 2024 (Afternoon) · Q29Which of the following statements is/are FALSE?
- GATE CS 2023 (Forenoon) · Q60Consider the syntax directed translation given by the following grammar and semantic rules. Here N, I, F and B are non-terminals. N is the…

