Wednesday, March 9, 2016

CS9353 - Principles of Compiler Design - April may 2014

Anna University Questions - CS9353 Principles of Compiler Design April May 2014, Computer Science and Engineering (CSE), Sixth semester, regulation 2008



Exam
B.E/B.Tech. (Full Time) DEGREE END SEMESTER EXAMINATIONS
Academic Year
April May 2014
Subject Code

CS9353

Subject Name

Principles of Compiler Design

Branch
Computer Science and Engineering
Semester
Sixth Semester
Regulation
2008


B.E / B.Tech. (Full Time) DEGREE END SEMESTER EXAMINATIONS, APRIL / MAY 2014
Computer Science and Engineering
Sixth Semester
CS9353 PRINCIPLES OF COMPILER DESIGN
(Regulations 2008)
Time : 3 Hours                      Answer A L L Questions                Max. Marks 100
PART-A (10 x 2 = 20 Marks)

1. Write the regular definition for "all strings of digits with atmost one repeated digit".
2. Consider the grammar: S -> aSbS | bSaS | €. Show that the grammar is ambiguous by constructing two different LMD for the sentence abab.
3. Differentiate Parse tree and syntax tree
4. Define Activation record and state its purpose
5. How back patching process is used to avoid the problem of generating code in single pass?
6. Draw syntax tree and DAG for (a*b) + (c-d)*(a*b)+b
7. How do you determine the leaders for basic block?
8. Comment on Next-use information
9. Define and give example for Copy propagation
10. Calculate the cost for the following instructions:
MOV R1,M and SUB E(R0),*4(R1)

Part-B (5* 16 = 80 Marks)

11 (i) Explain the Phases of Compiler in detail and show the translation of the statement: x= a + b *60 (6)
(ii) Eliminate Left recursion from the following grammar, Construct Predictive Parsing Table and parse the string (a,a) : S -> (L)|a , L->L,S|S                   (10)

12. (a) (i) Brief about Type names .Name Equivalence .Structural Equivalence and Coercion with examples (8)
(ii) How does the parameter passing technique call-by-value implemented? (8)
(OR)
12. (b) (i) Explain about various storage allocation strategies in detail (16)

13. (a) (i) Explain the Back patching process for the following expression:
p< q or r < s and t< u                                  (10)
(ii) Translate the expression -(a+b)*(c+d)+(a+b+c) into a sequence of three address statements and explain the representation with Quadruple, triple and Indirect triple (6)
(OR)
13. (b) (i) Explain the Syntax directed definition to produce three address code for Boolean Expressions using control flow translation method and Generate three address code for the stmt: If (x<100 || x>200 && x!=y) x=0;                                    (8)
(ii) In C, the FOR statement has the following form:                              (8)
for (e1 ; e2 ; e3) stmt
Taking its meaning to be
e1;
while ( e2 ) { stmt; e3;}
Construct a syntax-directed definition to translate "C-style for statements" into three
address code.

14. (a) (i) Construct a DAG for the following basic block and generate code by labeling the nodes based on the gencode() algorithm (10)
d : = b*c
e: = a+b
b : = b*c
a : = e-d
(ii) Explain about the Run time storage management (6)
(OR)
(b)(i) Generate optimal code using Dynamic Programming technique for the assignment statement x := (a+b * c ). Assume unit instruction costs. (16)

15. (a) (i) Perform all possible optimizations for the following statements               (10)
E = A + B
F = E - C
G = F * D
H = A + B
I = I - C
J = I + G
(ii) Explain the Optimization of Basic blocks                                                                  (6)
(OR)
15. (b) (i) For the following flow graph, compute the definitions reaching each and every block (16)


************************








No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery