Compiler Design Jan 2023
Compiler Design Jan 2023
|''|'||||''|'''|||'|
Code No: R2031421 R20 SET - 1
UNIT-V
9. a) Write the algorithm for a simple code generator. [7M]
b) Discuss about register allocation and assignment in target [7M]
code generation.
(OR)
10. a) Explain various issues that affect the efficiency of generated [7M]
code.
b) What are the different object code forms in code generation [7M]
and explain.
2 of 2
|''|'||||''|'''|||'|
Code No: R2031421
R2031011 R20 SET - 2
UNIT-I
1. a) Explain how lex program will perform the lexical analysis for the [7M]
following patterns in C:
Identifiers, comments, numerical constants and arithmetic
operators.
b) Construct NFA equivalent to regular expression r= (a + b)* ab [7M]
(aa+bb) and convert it into DFA.
(OR)
2. a) Consider the following Conditional statement: if (x > 3) then y = [7M]
5 else y = 10; How does lexical analyzer help the above
statement in process of compilation?
b) Define Regular Expression. Explain about the Properties of [7M]
Regular Expressions. Give examples.
UNIT-II
3. a) Check whether the grammar is LL (1) or not, and construct a [7M]
predictive parsing table for following grammar: S -> iEtSS1/ a,
S1eS / ε, E b.
b) Define Ambiguous Grammar? Check whether the grammar [7M]
SaAB, AbC/cd, Ccd, Bc/d, is Ambiguous or not?
(OR)
4. a) Parse the input string intid,id; using predictive parser for the [7M]
grammar:
S TL;
T int | float
L L,id | id
b) What is Dangling ELSE ambiguity? How it can be solved with LR [7M]
parsers? Explain with an example.
UNIT-III
5. a) Write the quadruple, triple, indirect triple for the expression - [7M]
(a*b) + (c+d)-(a+b+c+d).
b) For the grammar below: E → E + T | T, T → num .num | num [7M]
Give an SDD to determine the type of each term T and
expression E.
(OR)
6. a) Differentiate LR(0) and LR(1) items with examples [4M]
b) S L=R|R L *R|id RL construct CLR(1) parser and explain [10
the procedure. M]
1 of 2
|''|'||||''|'''|||'|
Code No: R2031421 R20 SET - 2
UNIT-IV
7. a) What is a leader of basic block? Write and explain the algorithm [7M]
used to find leaders. Draw flow graph for matrix multiplication.
b) Explain in detail about global common sub expression [7M]
elimination technique.
(OR)
8. a) Discuss in detail the role of dead code elimination and strength [7M]
reduction during code optimization of a compiler
b) Draw and explain the Runtime memory organization static [7M]
storage allocation strategy with pros and cons.
UNIT-V
9. a) Give an example to show how DAG is used for register allocation. [7M]
b) What are the object code forms? Explain the issues in code [7M]
generation.
(OR)
10. a) Discuss about register allocation and assignment in target code [7M]
generation.
b) Discuss about how to write a simple code generation algorithm. [7M]
2 of 2
|''|'||||''|'''|||'|
Code No: R2031421
R2031011 R20 SET - 3
|''|'||||''|'''|||'|
Code No: R2031421 R20 SET - 3
UNIT-V
9. a) Write the algorithm for a simple code generator. [7M]
b) Discuss about register allocation and assignment in target code [7M]
generation.
(OR)
10. a) Explain various issues that affect the efficiency of generated [7M]
code.
b) What are the different object code forms in code generation and [7M]
explain.
2 of 2
|''|'||||''|'''|||'|
Code No: R2031421 R20 SET - 4
1 of 2
|''|'||||''|'''|||'|
Code No: R2031421 R20 SET - 4
UNIT-IV
7. a) Explain in brief about Heap Storage allocation strategy. [7M]
b) Explain with suitable example various sources of loop [7M]
optimization.
(OR)
8. a) Generate basic blocks and flow graph for quick sort algorithm. [7M]
b) Discuss the role of structure preserving transformations in code [7M]
optimization.
UNIT-V
9. a) Give an example to show how DAG is used for register [7M]
allocation.
b) What are the object code forms? Explain the issues in code [7M]
generation.
(OR)
10. a) Discuss about register allocation and assignment in target code [7M]
generation.
b) Discuss about how to write a simple code generation algorithm. [7M]
2 of 2
|''|'||||''|'''|||'|