VIII Semester B.E. (CSE/ISE) Degree Examination, June/July 2013 (2K6 Scheme) CI – 8.2/IS – 8.4.1 : COMPILER DESIGN Time : 3 Hours
Max. Marks : 100
Instruction : Answer any five full questions, selecting atleast two from each Part. PART – A 1. a) Explain the various phases of a compiler with a neat diagram.
12
b) What is the purpose of the transition diagram ? Construct a transition diagram for 1) Arithmetic operators 2) Identifiers.
8
2. a) Explain how left recursion and left factoring of a grammar is carried out for the following grammar
10
S → Aa | b A → Ac | Sd | ∈
b) What is Input Buffering ? Explain the methods of input buffering in a compiler. 3. a) Discuss the LR and LL parsers with the following grammar S → i SeS | iS | a
10 10
b) Explain the stack implementation of shift reduce passing for the input id1 + id2 + id3 and consider the grammar E →E +E E →E*E E → (E) / id
10
P.T.O.
*JE838*
JE – 838
4. a) Generate LR parsing table for the following grammar and find whether the grammar is ambiguous or not.
12
S → AS S→b A → SA A→a
b) Explain with examples synthesized attributes and Inherited attributes.
8
PART – B 5. a) Briefly explain the different types of intermediate codes, with the example expression a : = b * – c + b * – c. b) Explain in detail various issues involved in code generation.
12 8
6. a) Explain how the run-time memory is divided into different data areas. What are the various allocation strategies used for respective data types ? 10 b) Explain the hash table implementation used for symbol tables.
10
7. a) What do you mean by machine independent code optimization ? Explain various code optimization methods. b) Explain the various strategies used for register allocation and assignment.
10 10
8. Write short notes on : i) Error recovery in LR parsers ii) Loops in flow graphs iii) Storage allocation strategies iv) Bottom-up evaluation of S-attributes.
—————————
(4×5=20)
COMPILER DESIGN.pdf
b) Explain the various strategies used for register allocation and assignment. 10. 8. Write short notes on : i) Error recovery in LR parsers. ii) Loops in flow graphs.