23CS503 COMPILER DESIGN
POSSIBLE QUESTIONS
UNIT 3
2 Marks
1. Give two examples of semantic analysis
2. State the types of three address statements
3. Write the equation for arrays
4. Translate the arithamric expression a*-(b+c) into syntax tree and postfix notation
5. State the intermediate code representation for the expression a or b and not c.
8 Marks
6. How would you correct the following into intermediate code? Give a suitable example :
Assignment statements
7. Explain the process of generating the code for a Boolean expression in a single pass using back
patching
16 Marks
8. Explain the three address code and its type? How is it implementing?
9. Explain the use of Intermediate Representation (IR) in Low-Level Virtual Machine (LLVM) and
Web Assembly (WASM). Describe their structure, advantages, and role in compiler design
Unit 4
2 Marks
1. State the Code Optimization.
2. Define Common sub Expression Elimination with example
3. Define Code Motion
4. Explain Loop fusion and loop jump
5. Define term evaluation point
6. state the advantages of using live variables
7. How would you represent the following equation using the DAG? a := b * c + b* - c
8. Write the grammar for flow control statement while - do
9. state the application of DAG
10. Give any two examples of strength reductions
8 Marks
11. Explain the Classification of Code Optimization.
12. Give the techniques used in Loop optimization
13. Explain about characteristics of peephole optimization
16 Marks
14. Sate the principle Sources of optimization? Explain the local optimization strategies with
appropriate examples
15. Define Global data flow Analysis. Briefly explain about types of global optimization.
16. Define DAG Representation. Construct DAG for
sum = 0;
for(i=0; i<=10; i++)
sum = sum+a[i];
Unit 5
2 Marks
1. state the various address modes used in code generation
2. Define address descriptor
3. Write the object code sequence for t:=a+b produced by a typical code generator.
4. Define target machine description
5. Compute the cost of following set of instruction.
MOV a,Ro;
ADD b,Ro;
MOV Ro,c;
6. Enlist the storage allocation strategies used in run time environment
7. state the limitations of static allocation
8. Define Activation record
9. State the methods of parameter passing? Explain.
10. Define transformations of basic blocks.
8Marks
11. Explain about Target machine code with cost of code generation.
12. Explain the sequence of stack allocation process for a function call.
13. Explain the modern compiler trends used for Machine Learning and Artificial Intelligence
applications. Discuss the working principles, architecture, and advantages of ML-specific
compilers such as XLA and TVM
16 Marks
14. Briefly Explain the issues in design of code generator and give suitable examples to support your
explanations.
15. What are different storage allocation strategies? Explain
16. Write the simple code geration algorithm. Translate the following assignment statement into
three address code x:=(a+b)*(c-d)+((e/f)*(a+b)) Apply code generation algorithm, generate a
code sequence for three address statement