Questions & Answers of Syntax-Directed Translation

Question No. 56

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

S  aA { print 1 }

S  a { print 2 }

A  Sb { print 3 }

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

Question No. 227

One of the purposes of using intermediate code in compilers is to

Question No. 244

Consider the basic block given below.
a = b + c
c = a + d
d = b + c
e = d - b
a = e + b
The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are

Question No. 54

In a simplified computer the instructions are:

OP Rj, Ri   - Performs Rj OP Ri OP Ri and stores the result in register Ri.
OP m, Ri    - Performs val OP Ri and stores the result in Ri. val denotes the content of memory location m.
MOV, m Ri   - Moves the content of memory location m to register Ri.
MOV Ri, m   - Moves the content of register Ri to memory location m.

The computer has only to registers, and OP is either ADD or SUB. Consider the following basic block:

t1 = a + b
t2 = c + d
t3 = e - t2
t4 = t1 - t3

Assume that all operands are initially in memory. The final value of the computation should be in memory. What is the minimum number of MOV instructions in the code generated for this basic block?