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-III

1. (a) Explain, in detail, lexical analyzer generator.

(b) Describe the lexical errors and various error recovery strategies with suitable examples. [8+8]

 

2. (a) Consider the following grammar.

S ! 0A|1B|0| 1

A ! 0S|1B| 1

B ! 0A|1 S

Construct leftmost derivations and parse trees for the following sentences

i. 0101

ii. 1100101

(b) Consider the following grammar

E ! T + E|T

T ! V_T|V

V ! id

Write down the procedures for the nonterminals of the grammar to make a recursive descent parser. [8+8]

 

3. (a) Define LR(k) parser. Draw and explain model of LR parser.

(b) Write LR parsing algorithm. [8+8]

 

4. (a) Write the quadruple, triple, indirect triple for the statement a := b_ ? c + b_ ? c.

(b) Explain the role of intermediate code generator in compilation process. [8+8]

 

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. Explain about data flow analysis of structured programs. [16]

 

8. (a) Explain the concept of object code forms.

(b) Generate optimal machine code for the following C program. [6+10]

main()

{int i, a[10];

while (i<=10) a[i] =0}

Leave a Comment