JNTU B-Tech II Semester Examinations,Compiler Design, Apr/May 2008

JNTU PAPERS

JNTU B.Tech II Semester Examinations

Compiler Design

 Apr/May 2008

(Computer Science & Engineering)

Time: 3 hours Max Marks: 80

Answer any FIVE Questions

All Questions carry equal marks

SET-IV

1. (a) Consider the following fragment of ‘C’ code:

float i, j;

i = i * 70 + j + 2;

Write the output at all phases of the compiler for the above ‘C’ code.

(b) Write short notes on: input buffering. [10+6]

 

2. (a) What is recursive descent parser? Construct recursive descent parser for the

following grammar.

E ! E + T|T

T ! TF|F

F ! F_|a|b

(b) What is ambiguous grammar? Eliminate ambiguities for the grammar:

E ! E + E|E_E|(E)|id. [8+8]

 

3. Construct SLR parsing table for the following grammar.

S ! AS|b

A ! SA|a [16]

 

4. Write short notes on the following:

(a) S-attributed definitions.

(b) L-attributed definitions.

(c) Dependency graph. [6+6+4]

 

5. (a) What is an ordered and unordered symbol table? What is the function of symbol table in the compliation process? Explain.

(b) What are the various attributes of a Symbol Table? [10+6]

 

6. Explain different principal sources of optimization technique with suitable examples. [16]

 

7. A flow graph is useful for understanding code generation algorithm? Justify your

answer with an example. [16]

 

8. Discribe various Register allocation optimization techniques with an example. [16]

Leave a Comment