SPPU Computer Engineering (Semester 7)
Principles of Modern Compiler Design
December 2015
Total marks: --
Total time: --
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary

Solve any one question from Q1 and Q2
1 (a) Why the analysis phase of compiler is normally separated into lexical analysis and parsing phases?
4 M
Explain the following in brief.
1 (b) (i) Operating system support for compiler.
3 M
1 (b) (ii) Memory management.
3 M

2 (a) Explain frontend phases of compiler with example.
6 M
2 (b) Describe role of Regular expression in lexical analysis. What is lookahead Operator?
4 M

3 (a) Compute First and Follow sets for following grammar. Also generate predictive parsing table for this grammar.
8 M
Solve any one question from Q3 and Q4
3 (b) Enlist different error recovery methods in parsing.
2 M

4 (a) Construct SLR parsing table for following grammar.
Also show moves by parser for the string 'xqy'.
7 M
4 (b) Explain how syntax directed translation scheme is implemented with topdown parser.
3 M

Solve any one question from Q5 and Q6
5 (a) What is code optimization? Differentiate among local, global and loop Optimization.
6 M
5 (b) Generate DAG from following 3 address statements.
T1 = b + c
T2 = d * e
T3 = d + c
T4 = T2 * T3
T5 = T4 * f
X = T1 - T5
Traverse this DAG using topological order and list the optimized code. Which optimization is carried out in this process?
5 M
5 (c) What is Register Allocation and Assignment problem?
4 M
5 (d) Why redundant load and store are undesirable in code generation process?
3 M

6 (a) Explain following data flow properties:
Available expression Reaching definitions live variables.
6 M
6 (b) Discuss following optimizations with examples:
Variable propagation, code movement.
4 M
6 (c) Which are various issues related to code generation.
4 M
6 (d) Write short note: Peephole optimization.
4 M

Solve any one question from Q7 and Q8
7 (a) Explain the structure of a functional compiler. Discuss various issues elated to compilation of functional languages by taking example of Haskell.
8 M
7 (b) Explain following with respect to Object Oriented languages: Type checking, Type equivalence, Type coercion.
6 M
7 (c) What is JavaCC?
2 M

8 (a) Explain following points with respect to functional language Haskell. Offside rule, Pattern matching, Referential transparency, Polymorphic Typing.
8 M
8 (b) Consider following features of Object Oriented languages:
Overloading and Polymorphism. Explain what changes are needed in compiler design to accommodate these features.
6 M
8 (c) What is lazy evaluation in functional languages?
2 M

Solve any one question from Q9 and Q10
9 (a) What is interpreter? Explain JVM as an example of interpreter.
4 M
9 (b) Discuss issues related to parallel compiler. Explain with respect to NVCC.
6 M
9 (c) Explain following points for parallel object oriented languages: Object location, object migration, object replication.
6 M

Write short notes:
10 (a) Tuple space
4 M
10 (b) XML VM
4 M
10 (c) Processes and threads
4 M
10 (d) JIT
4 M

More question papers from Principles of Modern Compiler Design