revision qp
revision qp
FN
PART-A
1. Define constant folding.
2. Define peephole optimization.
3. What is a basic block? Explain with an example
4. List the advantage and application of DAG.
5. What are the properties of optimizing compiler?
PART-B
6. Discuss the DAG representation of the basic block with an example.
7. Explain briefly about the principal sources of optimization.
8. Summarize in detail about the global data flow analysis with an example.
AN
PART-A
1. What are the structure preserving transformations on basic blocks?
2. List the characteristics of peephole optimization
3. What is code motion?
4. Define dead code elimination.
5. Construct and explain the DAG for the follow basic blocke
d:=b*c
e:=a+b
b:=b*c
a:=e-d.
PART-B
6. Formulate the steps for efficient Data Flow algorithm.
7. Analyze Peephole optimization with suitable examples.
8. Discuss about the following with example:
Copy Propagation
Dead-code Elimination
Code motion.
UNIT 4
PART-A
1. What is the use of run time storage?
2. What is an activation record?
3. What is heap allocation?
4. When do you call a variable to be syntactically live at a point?
5. What does dangling references mean?
PART-B
6. Explain about different storage allocation techniques.
7. Discuss about the issues in the design of code generator.
8. Construct the basic blocks and flow graph for the following
piece of code.
UNIT 3
PART-A
1.
What do you mean by Syntax Directed Translation (SDT)?
2.
Convert the following statements into three address codes
3.
X=a+(b*-c)+(d*-e).
4.
Write down the CFG for the set of odd length strings in {a,b}*
whose first, middle, and last symbols are same.
5. Define Symbol Table.
PART-B
6. Explain type checking and type conversion. Explain with an
example of converting the operands the same type.
7. 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
8. Illustrate the methods of implementing three address statements
PART-A
U4
1. Differentiate between stack and heap allocation.
2. Design a simple code generator with the help of an algorithm.
3. What is an activation record?
4. What is code motion?
PART-B U3
Write the syntax directed translation for the following piece of code.
switch E
begin
case V1 :S1
case V2 : S2
case Vn-1: Sn-1
default: Sn
end
Discuss the following in detail about the Syntax Directed Definitions.
(i)Inherited Attributes and Synthesized attributes. (6)
(ii)Evaluate SDD of a parse tree for the expression (4+7.5*3)/2 (7)
FN
PART-A
1. Define parser.
2. Define a context free grammar.
3. Define ambiguous grammar.
4. What is operator precedence parser?
5. List the properties of LR parser.
PART-B
6. Check whether the following grammar can be implemented using CLR. Check
whether the string “wxynzs” is accepted or not using CLR parsing.
A->BCD|Ab|c
B->w|Bx
C->yCz|n
D->DB|s
7. Write the algorithm for predictive parser and check whether the following
grammar can be implemented using it.
A->A
A->aB|Ad
B->bBC|f
C->g
8. Construct the SLR parsing table for the following grammar.
E->E+T|T
T->T*F|F
F->(E)|id
AN
PART-A
1. Define Lexeme.
2. Write short notes on YACC.
3. What is meant by handle pruning?
4. What are the disadvantages of operator precedence parsing?
5. Define left factoring.
PART-B
6. Briefly discuss design of syntax analyzer for a sample language.
7. Explain the following:
Give the comparison for various parsers
Give the structure of YACC program
8. Consider the grammar
S->ABD,
A->a | Db | ε ,
B->gD| dA |ε,
D->e | f
(i) Write the algorithm for FIRST and FOLLOW.
(ii) Construct FIRST and FOLLO W for each non terminal of the above grammar.
(iii) Construct the predictive parsing table for the grammar.
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