**Test papers of Andhra University **

**B Tech Computer Science & Engineering – **

C**ompiler Design**

**MODEL PAPER**

**B. Tech (CSE) Degree Examination**

**Third Year – Second Semester**

** **

Effective from the admitted batch of 2004-2005

Time: 3 hrs

Max Marks: 70

First Question is Compulsory

Answer any four from the remaining questions

All Questions carry equal marks

Answer all parts of any question at one place

1. a) Differentiate between Phase and Pass (7 X 2)

b) Define parsing tree

c) Define recursion

d) Differentiate between terminator and variable

e) Define DAG

f) Differentiate between assembler and interpreter

g) Define handle

2. a) Define FSM. Explain the application of FSM in the design of ‘LEXICAL ANALYSER’. (7)

b) Explain the application of grammar in the design of ‘COMPILER’. (7)

3. Construct First & Follow for the following grammar. (14)

E → TE^{1}

E^{1} → +TE^{1}/E

T → FT^{1}

T^{1} → FT^{1}/E

F → (E)/id

4. Define ‘LEFT RECURSION’. Give algorithm for the elimination of “LEFT RECURSION”. (14)

5. a) Translate a* – (b+c) into postfix form. (7)

b) Write quadruples, triples for the expression. (7)

-(a+b) * (c+d) – (a+b+c)

6. Construct SLR parsing table for the following grammar (14)

S^{1} → S

S → CC

C → Cc

C → d

7. Explain in brief in brief about intermediate code optimization algorithms. (14)

8. Explain

a) Peephole optimization (7)

b) Error detection and recovery. (7)