Skip to content

// Anna University, Chennai / 2022

Anna University — Compiler Design (CS8602), April/May 2022

Compiler Design · CS8602 · R2017 · B.E. Computer Science and Engineering · Semester 6

Files open in a new tab. Use your browser's download or save option to keep a copy.

Questions

16

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16

Has an official figure

Work through the questions

16 questions

No verified answers are available for this paper.

  1. Question 1

    Part ADescriptive2 marks

    Compilers

    Programmer A has written a program which needs to be modified very frequently. Which of the two languages Visual Basic (or) C++ can he use for his programming? Justify in two sentences. (Neglect other technical and environmental considerations).

    No verified answer or solution is available for this question.

  2. Question 2

    Part ADescriptive2 marks

    Compilers

    List out the phases included in the analysis phase of compiler.

    No verified answer or solution is available for this question.

  3. Question 3

    Part ADescriptive2 marks

    Compilers

    Write down the CFG for the set of odd length strings in {a, b}* whose first, middle and last Symbols are same.

    No verified answer or solution is available for this question.

  4. Question 4

    Part ADescriptive2 marks

    Compilers

    List out the steps for performing LR parsing.

    No verified answer or solution is available for this question.

  5. Question 5

    Part ADescriptive2 marks

    Compilers

    What do you mean by Syntax directed translation?

    No verified answer or solution is available for this question.

  6. Question 6

    Part ADescriptive2 marks

    Compilers

    Convert the following statement into three address codes x = a + (b * −c) + (d * −e) Represent the three address codes by Triples.

    No verified answer or solution is available for this question.

  7. Question 7

    Part ADescriptive2 marks

    Compilers

    When do you call a variable to be syntactically live at a point?

    No verified answer or solution is available for this question.

  8. Question 8

    Part ADescriptive2 marks

    Compilers

    When does dangling references mean?

    No verified answer or solution is available for this question.

  9. Question 9

    Part ADescriptive2 marks

    Compilers

    Define constant folding.

    No verified answer or solution is available for this question.

  10. Question 10

    Part ADescriptive2 marks

    Compilers

    Identify and write down the optimizations that could be performed on a Peephole.

    No verified answer or solution is available for this question.

  11. Question 11

    Part BDescriptive13 marks

    Compilers

    (a) Elaborate on the different phases of compiler with a neat sketch. Show the output of each phase of the compiler when the following statement is parsed. SI = (p *n*r)/100 Where. n should only be an integer p and r could be floating point numbers (OR) (b) Convert the following NFA to DFA.

    Official figure for question 11
    The NFA for part (b).

    No verified answer or solution is available for this question.

  12. Question 12

    Part BDescriptive13 marks

    Compilers

    (a) Check whether the following grammar can be implemented using Predictive parser. Check whether the string "abfg" is accepted or not using predictive parsing. A → A A → aB | Ad B → bBC | f C → g (OR) (b) Check whether the following grammar can be implemented using Predictive parser. Check whether the string "(a,a)" is accepted or not using predictive parsing. S → (L) | a L → L,S | S

    No verified answer or solution is available for this question.

  13. Question 13

    Part BDescriptive13 marks

    Compilers

    (a) Write the syntax directed translation for the following code: E → E₁ or E₂ E → E₁ and E₂ E → not E₁ E → (E₁) E → id₁ relop id₂ E → true E → false (OR) (b) Write the syntax directed translation for the following piece of code. while a < b do if c < d then x : = y+z else x :=y−z

    No verified answer or solution is available for this question.

  14. Question 14

    Part BDescriptive13 marks

    Compilers

    (a) Elaborate the issues in developing a code generator. (OR) (b) Construct the basic blocks and flowgraph for the following piece of code. for i from 1 to 10 do for j from 1 to 10 do a[i, j] = 0.0; for i from 1 to 10 do a[i,i]=1.0;

    No verified answer or solution is available for this question.

  15. Question 15

    Part BDescriptive13 marks

    Compilers

    (a) Describe the parameter passing techniques with an example. (OR) (b) Explain the storage allocation techniques with an example.

    No verified answer or solution is available for this question.

  16. Question 16

    Part CDescriptive15 marks

    Compilers

    (a) Consider the following basic block, in which all variables are integers and ** denotes exponentiation a := x ** 2 b := 3 c := x d := c * c e := b * 2 f := a + d g := e * f Apply the following optimization techniques to this basic block, in order. Compute the result of each transformation. (i) Algebraic Simplification (3) (ii) Copy Propagation (3) (iii) Constant Folding (3) (iv) Dead Code Elimination (3) (v) Common Sub-expression Elimination (3) (OR) (b) Construct LR(l) items for the following grammar and draw the transition diagram representing the transitions among CLR items. S → CC C → cC C → d Show whether the string "cdcd" is accepted by this grammar or not.

    No verified answer or solution is available for this question.

Keep preparing

Revisit another year or explore a different paper in the library.

More from this exam