(a) Write syntax directed definitions (semantic rules) for the following…

PYQ GATE 1992

(a) Write syntax directed definitions (semantic rules) for the following grammar to add the type of each identifier to its entry in the symbol table during semantic analysis. Rewriting the grammar is not permitted and semantic rules are to be added to the ends of productions only.

D → TL;

T → int

T → real

L → L, id

L → id

(b) Write 3-address intermediate code (quadruples) for the following boolean expression in the sequence as it would be generated by a compiler. Partial evaluation of Boolean expressions is not permitted. Assume the usual rules of precedence of the operators.

(a + b) > (c + d) or a > c and b < d

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…