[go: up one dir, main page]

0% found this document useful (0 votes)
388 views3 pages

Compiler Design Question Bank

This document contains a question bank for the Compiler Design course unit on code generation. It includes 31 short answer questions and 17 long answer/essay questions on topics related to code generation including: syntax-directed definitions, translation schemes, intermediate representations like 3-address code, symbol tables, storage allocation strategies, runtime environments, boolean expressions, and control flow statements. The questions cover code generation concepts as well as asking students to complete tasks like generating 3-address code and syntax trees for expressions and program fragments.

Uploaded by

Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
388 views3 pages

Compiler Design Question Bank

This document contains a question bank for the Compiler Design course unit on code generation. It includes 31 short answer questions and 17 long answer/essay questions on topics related to code generation including: syntax-directed definitions, translation schemes, intermediate representations like 3-address code, symbol tables, storage allocation strategies, runtime environments, boolean expressions, and control flow statements. The questions cover code generation concepts as well as asking students to complete tasks like generating 3-address code and syntax trees for expressions and program fragments.

Uploaded by

Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

VADAPALANI CAMPUS
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
18CSC304J- COMPILER DESIGN
QUESTION BANK
Unit – 4
Short Questions
1. Design a parse tree according to the syntax directed definition, for the
following input statement : (4 + 7.5 * 3) / 2
2. Write the 3-address code for : x = *y; a = &x.
3. Place the above generated 3-address code in Triples and indirect Triples
4. List out the various storage allocation strategies
5. What are the types of intermediate languages?
6. Give syntax directed translation for case statement.
7. What is the significance of intermediate code?
8. Explain symbol table.
9. Explain Induction variable.
10. Translate the arithmetic expression a * - ( b + c ) into syntax tree and postfix
notation.
11. Prepare a list of fields in an activation record.
12. Give examples for static check.
13. Explain translation scheme.
14. Mention the role of semantic analysis.
15. Show syntax tree for the expression a = b * -c + b * -c
16. Why are quadraples preferred over triples in an optimizing compiler?
17. Discover the 2 attributes of syntax directed translation into 3-address code.
18. Classify the types of three address statements?
19. Point out the two rules for type checking.
20. What are the limitations of static allocation?
21. Design a parse tree according to the SDD, for the following input statement : (4 + 7.5
* 3) / 2
22. Translate the arithmetic expression a * - ( b + c ) into syntax tree and postfix notation.
23. Explain SDD and translation scheme.
24. How backpatching can be performed
25. What are the types of boolean expression
26. Define register and address descriptors
27. State the issues in cross compiler
28. What is representation of T-diagrams
29. Difference between inherited and synthesized attributes
30. What are the types of three-address code representation
31. Which representation is preferred for converting the productions into syntax direction
definition (compare among syntax tree vs infix vs postfix)
32. What do you mean by cross –compiler?
33. Define SDD? Give example
34. Define translation scheme? Give the types of translation schemes available
35. Generate code for the following C statement assuming three registers are available
x := a / ( b + c ) - d * ( e + f ).

Big Questions:
1. Explain simple code generator algorithm
2. Explain the various issues in code generator with example
3. (i) Give a syntax-directed definition to differentiate expressions formed by
applying the arithmetic operators + and * to the variable x and constants ;
expression : x * ( 3 * x + x * x ).
(ii) How names can be looked up in the symbol table? Discuss.
4. For the given program fragment A[i,j] = B[i,k] do the following :
(i) Draw the annotated parse tree with the translation scheme to convert to
three address code.
(ii) Write the 3-address code.
(iii) Determine the address of A[3,5] where all are integer arrays with size
of A as 10 x 10 and B as 10 x 10 with k=2 and the start index position of
all arrays is at 1. (Assume the base addresses )
5. Discuss - runtime environment with suitable example.
6. Generate intermediate code for the following code segment along with the
required syntax directed translation scheme.
while ( i < 10 ) if ( i % 2 == 0 )
evensum = evensum + i
else
oddsum = oddsum + i
7. How would you convert the following into intermediate code? Give suitable
example
(i) Assignment statements and use the scheme for generating three address
code for g:= a + b - c * d.
(ii) Case statements.
8. (i) Explain the translation scheme for flow of control statement.
9. (ii) Explain and compare in detail the various implementation forms of three
address code.
10. Write the grammar and translation scheme for procedure call statements.
11. Discuss runtime storage management in detail.
12. Write down the translation scheme to generate three address for the assignment
statements.
13. Translate the following switch statement into intermediate code.
switch E
begin
case V1 : S1
case V2 : S2
case Vn-1 : Sn-1
default : Sn
end
(ii) Discover three address code for boolean expression. a < b or c < d and e < f
14. Write short notes on runtime storage management of a code generator.
15. Explain simple code generator algorithm. Generate code for the statement
a. x = a / ( b - c ) - g * ( e + f ).
16. Explain the concept of T-diagrams with example
17. Explain declarative statement with suitable example

You might also like