IA3-CTCD QB - COE-General 20.9.24 New
IA3-CTCD QB - COE-General 20.9.24 New
Course Objectives:
COSNO Course Objectives
1. To understand foundations of computation and construct models of regular expressions
2. To design context free grammar, pushdown Automata and Turing machine
3. To understand intermediate code generation
4. To understand run-time environment and implement code generator
5. To learn to implement code optimization
Course Outcomes:
On Completion of the course the students will be able to
CONO Course Outcomes RBTLevel
1. Construct Finite Automata and write regular expressions for any L2
pattern
2. Design context free grammar, pushdown Automata and Turing L3
Machine computational functions
3. Understand semantic rules and intermediate code generation L2
4. Understand the run-time environment and implement code generation L2
5. Apply code optimization techniques L3
UNIT TITLE
I FORMAL_LANGUAGE_AND_REGULAR_EXPRESSIONS
L1 CO1 2 RE
1 Define a regular expression.
L1 CO1 2 Finite
2 What is a finite automaton? Automat
a
CO1 2 DFA,
3 Distinguish between DFA and NFA. L2
NFA
L3 CO1 2 Conversi
on of RE
Construct an €NFA for th regular to NFA
10
expression (a∣b)∗ab.
over Σ={0,1}.
Convert the NFA for the regular L3 CO1 2 NFA
13
expression a(b∣c)∗d to a DFA. to
DF
A
Show the transition table for a DFA L3 CO1 2 DFA
14 that recognizes the language
L={w∣w starts with 1} over Σ={0,1}.
Design a DFA for the language L3 CO1 2 DFA
15 L={w∣w contains no consecutive 1s}
over Σ={0,1}.
16 Draw the transition diagram for an NFA L3 CO1 2 NFA
that accepts strings over Σ={a,b} ending
with ba.
Design a DFA for the language L3 CO1 2 DFA
17 L={w∣w contains at most one 1}
over Σ={0,1}.
CO1 2 RE
18 What is the role of regular expressions L2
in pattern matching?
(0+1)*+(0+1)*
Construct the NFA transition diagram L3 CO1 12 RE
22 from the given below regular expression
a*ba+b*ab
To find equivalent DFA from the below L3 CO1 12 DFA
NFA transition diagram
a,b
23 a b
UNIT TITLE
II CONTEXT_FREE_GRAMMARS_AND_PARSING
CO2 2 Parse
3 What is a parse tree? L1
tree
30 L3 CO2 6
PDA
i)Design a PDA that accepts the language
{an bn | n ≥ 1}. 6
L3 Ambiguous
ii)Is the following grammar ambiguous? grammar
Justify your answer:
S → SS | ab | ba
31 Design a CFG for arithmetic expressions L4 CO2 12
CFG
involving addition, subtraction,
multiplication, and division. Show
derivations for 3 + 5 * 2.
UNIT TITLE
III SYNTAX_DIRECTED_TRANSLATION_AND_INTERMEDIAT
E_CODE_GENERATION
L1 CO3 2 L-
3 What is an L-attributed grammar? attributed
grammar
What is an abstract syntax tree (AST)? L1 CO3 2 AST
4
UNIT TITLE
IV RUN_TIME_ENVIRONMENTS_AND_CODE_GENERATION
L1 CO4 2 storage
1 Define storage organization organizat
ion
L1 CO4 2 storage
3 Define static Allocation organizati
on
L1 CO4 2 storage
4 Define stack Allocation organizati
on
5 What is meant by Heap Allocation? L2 CO4 2 storage
organization
CO4 2 parameter
6 Define parameter passing L2
passin
g
L1 CO4 2 symbol
7 Define symbol Table
Table
What is meant by dynamic storage CO4 2 storage
8 L1
organizati
Allocation?
on
9 What are the issues in the design of code L1 CO4 2 code
generator
generator
10 Define basic blocks L1 CO4 2 basic
blocks
11 Define flow graph L1 CO4 2
flow graph
12 L2 CO4 2
Define Register descriptor Register
descriptor
13 L1 CO4 2
Define address descriptor address
descriptor
14 L1 CO4 2
What are the entries in symbol table? symbol
table
15 Define Lexical analyzer and syntax L1 CO4 2
Lexical
analysis analyzer
16 L1 CO4 2
What are the phases of compiler phases of
compiler
17 L2 CO4 2
Define code generation code
generation
18 L2 CO4 2
Define instruction selection Instruction
selection
19 L1 CO4 2
storage
What is Register Allocation
organizati
on
20 L2 CO4 2 Memor
Define Memory Management Mana
gemen
t
21 Write a simple code generator L3 CO4 12
simple
algorithm with an example code; code
generator
show how the algorithm generates
code.
22 CO4 12
What is a symbol table? What type of symbol
table
information is stored in it? Discuss the use
L4
of data structures for implementing a
symbol table.
23 L3 CO4 12
storage
Discuss in Storage allocations strategies organizati
on
24 L3 CO4 12
Parameter
Discuss in Parameter passing methods passing
25 L3 CO4 12
Explain about the storage organization in storage
organizati
Runtime Memory. on
26 L3 CO4 12
Write down the algorithm for partitioning intermedia
intermediate code into Basic block with an te code
example
27 CO4 12
Explain about the dynamic storage storage
organizati
allocation with example
on
L4
28 L3 CO4 12
code
Explain about the optimal code generation
generation
for expression with example.
29
Compute the basic blocks for the given
three address statements. Draw the
corresponding flow graph.
(1) PROD = 0 CO4 L4 basic
(2) I = 1 blocks
(3) T2 = addr(A) – 4
(4) T4 = addr(B) – 4
16
(5) T1 = 4 x I
(6) T3 = T2[T1]
(7) T5= T4[T1]
(8) T6 = T3 x T5
(9) PROD = PROD + T6
(10) I = I + 1
(11) IF I <=20 GOTO (5)
(12) IF J<=5 GOTO (7)
(13)I=I+J
30 16
Explain in detail about issues in the design code
L3
CO4 generator
of a code generator
31 Write down the Code Generation, Register 16
Code
descriptor and Address Descriptor for three CO4 Generatio
L3
n
address statement
F=(a+c)-(a+b)-(a+b)
UNIT TITLE
V CODE_OPTIMIZATION
L1 CO5 2 Optimiza
1 Define Optimization tion
L1 CO5 2 Optimizatio
2 Define Peephole Optimization n
L1 CO5 2 DAG
3 What is meant by DAG?
L1 CO5 2 Optimizati
4 Define common Expression Elimination
on
18 L2 CO5 2
What is meant by structure preserving structure
preserving
optimization? optimizati
on
19 L1 CO5 2
Define data flow equations data flow
equations
20 L2 CO5 2 algebraic
transf
What is meant by algebraic transformation?
ormati
on
21 CO5 12
global data
Explain global data flow analysis with flow
necessary equations analysis
L4
22 CO5 12
Discuss in detail about optimization of optimizati
on of basic
basic blocks blocks
L4
23 CO5 12
Explain in detail about peephole peephole
optimizati
optimization on
L4
24 CO5 12
Explain about the construction of DAG DAG
Algorithm
Algorithm
L4
25 CO5 12
Explain about the transformation of basic basic
blocks
blocks.
L4
26 What are the principal sources of CO5 L3
optimizati
optimization? Explain with suitable 16
on
examples.
27 Construct DAG for the following basic CO5 L4 16
DAG
block Algorithm
1. t1:= 4i;
2. t2:= a[t1]
3. t3:= 4*i
4. t4:= b[t3]
5. t5:= t2*t4
6. t6:= prod +t5
7. prod:= t6
8. t7:= i+1
9. i:=t7
10. if I <= 20
goto(1)
28 Construct the Directed Acyclic Graph for CO5 L4 16
DAG
the following statement Algorithm
a=b*c
d=b
e=d
b=e
f=b+c
g=f+d