P.E.S. College of Engineering, Mandya - 571 401
P.E.S. College of Engineering, Mandya - 571 401
1
U.S.N
Contd…2
P15CS63 Page No... 2
UNIT - IV
7 a. Construct DAG for the following expression :
3
a + a ∗ (b - c) + (b - c) ∗ d
b. Write grammar syntax directed definition for a simple desk calculator and show the annotated
12
parse tree for the expression (8+6) ∗ (3+2).
c. Define type-checking rules for coercion from integer to real. 5
8 a. Explain the following parameters parsing methods :
i) Call by value ii) Call by reference 12
iii) Call by name iv) Copy restore
b. Explain the following with example :
i) Inherited attribute 8
ii) Synthesized attribute
UNIT - V
9 a. For the assignment statement a = b ∗ - c + b ∗ - c. Write sequence of;
i) Three address code for the syntax tree
10
ii) The address code for DAG
iii) Give its Quadruple, Triple and Indirect representation
b. Write grammar for control-flow statements and give syntax directed definition for flow of
10
control statements.
10 a. Explain any five issues in the design of code-generation. 10
b. Define basic block with example. Write an algorithm to partition a sequence of three address
statements into basic blocks. Find the basic blocks in the following three address code :
i) prod : = 0
ii) i : = 1
10
iii) t1 : = 4 ∗ i
iv) t2 : = t1+6
v) prod := t1∗ t2
vi) if prod >10 goto (iii)
****