JNTU B.Tech II Semester Examinations, COMPILER DESIGN, Apr/May 2008

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


1. Explain the input buffer scheme for scanning the source program. How the use of

sentinels can improve its performance? Describe in detail. [16]


2. Construct predictive parsing table for the following grammar.

E ! T E?

E? ! +T E?|?

T ! F T?

T? ! ?FT?|?

F ! (E)|id [16]


3. (a) What is an operator grammar? Give an example.

(b) Write an operator precedence parsing algorithm. [6+10]


4. (a) Write a note on the specification of a simple type checker.

(b) What is a type expression? Explain the equivalence of type expressions with an appropriate examples. [8+8]


5. (a) Compare three different storage allocation strategies.

(b) Consider the following array declaration in ā€˜cā€™;

float a[100][100];

Assume that the main memory in byte addressable and that the array is stored starting from the memory address 100. What is the address of a[40][50]?[8+8]


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


7. (a) Write and explain live variable analysis algorithm.

(b) Explain the use of algebraic transformations with an example [8+8]


8. (a) Explain the different issues in the design of a code generator.

(b) Generate code for the following C statements:

i. x= f(a) + f(a) + f(a)

ii. x= f(a) /g(b,c)

iii. x= f(f(a))

iv. x= ++f(a) [8+8]

Leave a Comment