JNTU III B.Tech Supplimentary Examinations, Aug/Sep 2008
(Computer Science & Engineering)
1. (a) Explain the different phases of a compiler, showing the output of each phase,
using the example of the following statement:
position : = initial + rate * 60
(b) Compare compiler and interpreter with suitable diagrams.
2. (a) Give the rules for computation of FIRST(X) and FOLLOW(X). Construct
FIRST and FOLLOW sets for the following grammar.
E ! T E?
E? ! +T E?|?
T ! F T?
T? ! ?FT?|?
F ! (E)|id
(b) Write an algorithm for construction of predictive parsing table.
3. (a) What is an operator grammar? Give an example.
(b) Write an operator precedence parsing algorithm.
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.
5. (a) Explain the hash table with temporary and permanent storage.
(b) Reusing the storage space for names.
6. (a) What is DAG? Construct the DAG for the following basic block
D := B?C
B := B+C
A := E-D
(b) What are the legal evaluation orders and names for the values at the nodes for the DAG of problem (a).
i. Assuming A, B and C are alive at the end of the basic block?
ii. Assuming only A is live at the end?
7. (a) What is an Induction variable? Explain with an example.
(b) Discuss how induction variables can be detected and how transformation can be applied.
8. (a) Describe, how addressing modes can be used for reducing the memory access time
(b) Generate the code sequence using Code generation algorithm for the following