Compiler Design Unit 5, 6 (Part 1) Questions

2
Unit 5 (Syntax-Directed Translation): Questions 1 *(VTU Question) Briefly describe the concept of syntax directed definition 2 a) * (VTU Question) Explain the following terms with an example: i) Synthesized attributes ii) Inherited attributes b) Define S-attributed and L-attributed SDDs 3. *(VTU Question) Give syntax directed definition with inherited attribute L.inh Show annotated parse tree for the sentence real id 1 , id 2 , id 3 . (Note: A similar question can be asked for int a,b,c). 4. *(VTU Question) Obtain the syntax directed definition for a simple desk calculator. Obtain an annotated parse tree for the expression 4*8+6n 5. *(VTU Question) Give syntax directed definition for constructing an expression syntax tree. Construct syntax tree for expression a-4*c and give sequence of function calls. 6. *(VTU Question) Explain with examples Postfix notation in Syntax Directed Translation. 7. Give rules for converting L attributed SDD to an SDT. Write the SDD for While statement and its SDT. Unit 6 (Intermediate Code Generation) Part 1 of 2: Questions 1 a) *(VTU Question) Write short notes on the DAG representation Page 1 of 2

description

Compilers

Transcript of Compiler Design Unit 5, 6 (Part 1) Questions

Page 1: Compiler Design Unit 5, 6 (Part 1) Questions

Unit 5 (Syntax-Directed Translation): Questions

1 *(VTU Question) Briefly describe the concept of syntax directed definition

2 a) * (VTU Question) Explain the following terms with an example: i) Synthesized attributes ii) Inherited attributes b) Define S-attributed and L-attributed SDDs

3. *(VTU Question) Give syntax directed definition with inherited attribute L.inh Show annotated parse tree for the sentence real id1, id2, id3. (Note: A similar question can be asked for int a,b,c). 4. *(VTU Question) Obtain the syntax directed definition for a simple desk calculator. Obtain an annotated parse tree for the expression 4*8+6n

5. *(VTU Question) Give syntax directed definition for constructing an expression syntax tree. Construct syntax tree for expression a-4*c and give sequence of function calls.

6. *(VTU Question) Explain with examples Postfix notation in Syntax Directed Translation.

7. Give rules for converting L attributed SDD to an SDT. Write the SDD for While statement and its SDT.

Unit 6 (Intermediate Code Generation) Part 1 of 2: Questions

1 a) *(VTU Question) Write short notes on the DAG representation b) *(VTU Question) Obtain directed acyclic graph for the expression a+a*(b-c)-(b-c)*c. also give the sequence of instructions for constructing the above DAG.

2. *(VTU Question) Explain implementation of 3 address code with an example.

3. *(VTU Question) Explain with examples Quadruples, Triples and indirect Triple representation

4. *(VTU Question) Translate the following expression:

((A<B) AND ((B>C) OR (A>C)))into 3-Address code, Quadruple, Triple and indirect Triple representation

5. Write short notes on a) SSA, b) Types & declarations and c) Storage Layout

Page 1 of 1