CS 2352 PRINCIPLES OF COMPILER DESIGN APRIL/MAY 2011 ANNA UNIVERSITY QUESTION PAPER QUESTION BANK IMPORTANT QUESTIONS 2 MARKS AND 16 MARKS
CS-2352 PRINCIPLES OF COMPILER DESIGN APRIL/MAY 2011 ANNA UNIVERSITY QUESTION PAPER QUESTION BANK IMPORTANT QUESTIONS 2 MARKS AND 16 MARKS
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011
Sixth Semester
Computer Science and Engineering
CS 2352 — PRINCIPLES OF COMPILER DESIGN
(Regulation 2008)
Time : Three hours Maximum : 100 marks
Answer ALL questions
PART A — (10 × 2 = 20 marks)
1. What is an interpreter?
2. Define token and lexeme.3. What is handle pruning?
4. What are the limitations of static allocation?
5. List out the benefits of using machine-independent intermediate forms.
6. What is a syntax tree? Draw the syntax tree for the following statement:
. : c b c b a − ∗ + − ∗ =
7. List out the primary structure preserving transformations on basic block.
8. What is the purpose of next-use information?
9. Define dead-code elimination.
10. What is loop optimization?
PART B — (5 × 16 = 80 marks)
11. (a) (i) Describe the various phases of complier and trace the program
segment 4 : ∗ + = c b a for all phases. (10)
(ii) Explain in detail about compiler construction tools. (6)
Or
(b) (i) Discuss the role of lexical analyzer in detail. (8)
(ii) Draw the transition diagram for relational operators and unsigned
numbers in Pascal. (8)
12. (a) (i) Explain the error recovery strategies in syntax analysis. (6)
(ii) Construct a SLR construction table for the following grammar.
T E E + →
T E →
F T T ∗ →
F T →
( ) E F →
id F → (10)
Or
(b) (i) Distinguish between the source text of a procedure and its
activation at run time. (8)
(ii) Discuss the various storage allocation strategies in detail. (8)
13. (a) (i) Define three-address code. Describe the various methods of
implementing three-address statements with an example. (8)
(ii) Give the translation scheme for converting the assignments into
three address code. (8)
Or
(b) (i) Discuss the various methods for translating Boolean expression. (8)
(ii) Explain the process of generating the code for a Boolean expression
in a single pass using back patching. (8)
132 132 132
11267 3
14. (a) (i) Write in detail about the issues in the design of a code generator.
(10)
(ii) Define basic block. Write an algorithm to partition a sequence of
three-address statements into basic blocks. (6)
Or
(b) (i) How to generate a code for a basic block from its dag
representation? Explain. (6)
(ii) Briefly explain about simple code generator. (10)
15. (a) (i) Write in detail about function-preserving transformations. (8)
(ii) Discuss briefly about Peephole Optimization. (8)
Or
(b) (i) Write an algorithm to construct the natural loop of a back edge. (6)
(ii) Explain in detail about code-improving transformations. (10)
0 comments:
Post a Comment