Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

April May 2023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

[No.

of Printed Pages - 4] 219

CSE304 Enrol. No.


[ET]

END SEMESTER EXAMINATION: April-May, 2023

COMPILER CONSTRUCTION

Time : 3 Hrs. Maximum Marks : 60

Note: Attempt questions from all sections as directed.

SECTION - A (24 Marks)


Attempt any four questions out of five.
Each question carries 06 marks.

1. For a source language statement a =b*c - 2, where


a, b and c are float variables, and - represents
multiplication and subtraction on same data types,
show the input and output at each of the compiler
phases.

2. What is handle pruning? Indicate the handles in the


reduction of the right sentential form S S+ a * to the
start symbol using the grammar below :
S -> SS+|SS* |a

P.T.O.
CSE304 2

3, Construct canonical collection of LR(1) items for the


following grammar :
S’ AA, A ’ Aa | b

4 Write the SDD for a simple type declaration and


draw the annotated parse tree for the declaration fioai
a, b, c.

S Explain storage organization and storage allocation


strategies.

SECTION - B (20 Marks)


Attempt any two questions out of three.
Each ques tion carries 10 marks.

6. Consider the following grammar

E ’E or T T

T’T and F |F

F’ not F|(E) | true false

(a) Remnove left recursion from the grammar. (3)

() Construct a predictive parsing table. (4)


CSE304 3 219

(c) Justify the statement "The grammar is LL (1)".


(3)

7. (a) Design a recursive descent parser for the grammar


E->E + T|TT -> T*F |FF-> (E) | id (5)

(b) Find out context free language for the


grammar
given below :

S -> abB A -> aaBb | [ B -> bbAa


(5)

8 Explain different code optimization techniques


available in local and global optimizations.

SECTION - C (16 Marks)


(Compulsory)

9. (a) Construct DAG for the expression (a/10 +


(b-10))* (a/10 + (b-10). Also write the sequence
of instructions used for the DAG construction.

(8)

(b) Write the code generation algorithm. Using this


algorithm generate code sequence for the
expression x = (a-b) + (a + c). (4)

P.T.0.
CSE304 4 219

(c)- Write SDD to produce three-address code for


Boolean expressions and obtain the three-address
code for the statement given below

while a<b do ifc<d then x =y t z else x =y-z


(4)

(800)

You might also like