Model Qp Pcd

3
Vijayamangalam – 638 056 Department: Computer Science and Engineering Date: 16.04.2015 MODEL EXAM Date of Exam 21.04.15 Time & Duration of Exam 10.00 A.M-01.00 P.M & 3 Hrs Branch CSE Year & Semester III & VI Max. marks:100 Subject Code CS2352 Subject’s Name: Principles of Compiler Design Part – A 10*2=20 1. Mention few cousins of compiler. 2. What are the possible error recovery actions in lexical analyzer? 3. Define an ambiguous grammar. 4. What is dangling reference? 5. Why are quadruples preferred over triples in an optimizing compiler? 6. List out the motivations for back patching. 7. Define flow graph. 8. How to perform register assignment for outer loops? 9. What is the use of algebraic identities in optimization of basic blocks? 10. List out two properties of reducible flow graph? Part –B 5*16=80 Answer all the Questions 11. (a) (i) What are the various phases of the compiler? Explain each phase in detail.(8) (ii) Briefly explain the compiler construction tools. (8) OR 11. (b) (i) What are the issues in lexical analysis? (8) (ii)Elaborate in detail the recognition of tokens. (8) 12. (a) (i) Construct the predictive parser for the following grammar. (8) S->(L)/a L->L,S/S SCE/AMC 1.14 Rev 0.0 01.01.2015

description

Model Qp Pcd

Transcript of Model Qp Pcd

Vijayamangalam 638 056Department: Computer Science and Engineering

Date: 16.04.2015MODEL EXAMDate of Exam21.04.15Time & Duration of Exam10.00 A.M-01.00 P.M & 3 Hrs

BranchCSEYear & SemesterIII & VIMax. marks:100

Subject CodeCS2352Subjects Name: Principles of Compiler Design

Part A

10*2=20

1. Mention few cousins of compiler.

2. What are the possible error recovery actions in lexical analyzer?

3. Define an ambiguous grammar.

4. What is dangling reference?

5. Why are quadruples preferred over triples in an optimizing compiler?

6. List out the motivations for back patching.

7. Define flow graph.

8. How to perform register assignment for outer loops?

9. What is the use of algebraic identities in optimization of basic blocks?

10. List out two properties of reducible flow graph? Part B

5*16=80Answer all the Questions

11. (a) (i) What are the various phases of the compiler? Explain each phase in detail.(8)(ii) Briefly explain the compiler construction tools. (8)OR

11. (b) (i) What are the issues in lexical analysis? (8)(ii)Elaborate in detail the recognition of tokens. (8)12. (a) (i) Construct the predictive parser for the following grammar. (8)S->(L)/a

L->L,S/S

(ii)Describe the conflicts that may occur during shift reduce parsing. (8)OR

12. (b) (i)Explain the detail about the specification of a simple type checker. (8)(ii)How to subdivide a run-time memory into code and data areas. Explain(8).

13. (a) (i) Describe the various types of three address statements. (8)(ii)How names can be looked up in the symbol table? Discuss. (8)OR

13. (b) (i)Discuss the different methods for translating Boolean expressions in detail. (8)(ii) Explain the following grammar for a simple procedure call statement S->call id (enlist). (8)14. (a) (i) Explain in detail about the various issues in design of code generator. (8)(ii)Write an algorithm to partition a sequence of three address statements into basic blocks. (8)OR

14. (b) (i)Explain the code-generation algorithm in detail. (12)(ii)Construct the dag for the following basic block. (4)d: =b*c

e: = a +b

b: =b*c

a: =e-d15. (a) (i) Explain the principle sources of optimization in detail. (8)(ii)Discuss the various peephole optimization techniques in detail. (8)OR

15. (b) (i) How to trace data-flow analysis of structured program? (8)(ii) Explain the common sub expression elimination, copy propagation, and transformation for moving loop invariant computations in detail. (8)Prepared byVerified by

Sign:

Name:K.Uma MaheswariJ.Sathish Kumar

FacultyHD

SCE/AMC 1.14 Rev 0.0 01.01.2015