JNTU papers B -Tech Examinations, IIIrd sem Computer design, Aug/Sep 2008

JNTU III B.Tech Supplimentary Examinations, Aug/Sep 2008

COMPILER DESIGN

(Computer Science & Engineering)

SET-III

1. Explain with an example, how LEX program performs lexical analysis for the fol-

lowing patterns in C :

identifier, comments, constants, and arithmetic operators.

 

2. Construct predictive parsing table for the following grammar.

E ! T E?

E? ! +T E?|?

T ! F T?

T? ! ?FT?|?

F ! (E)|id

 

3. (a) Explain the stack implementation of shift reduce parsing method with an example.

(b) Define handle. Give suitable example.

 

4. Write short notes on the following:

(a) S-attributed definitions.

(b) L-attributed definitions.

(c) Dependency graph.

 

5. Only one occurrence of each object is allowable at a given moment during program

execution. Justify your answer with respect to static allocation.

 

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

 

7. Describe, how redundant expression elimination can be done in loop optimization

technique, during global optimization.

 

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)

Leave a Comment