CT2353
CT2353
CT2353
1. (A) (A1) What is the theory and logic behind cross – compilation ? 4(CO1)
(A2) Apply Loop invariant computation optimization technique and eliminate
loop invariant computation from the given program fragment.
P=0
Q=1
do
P = P + X [I] * Y [I}
Q=Q+1
End
While Q <= 20 6(CO5)
OR
(B) (B1) Explain Fast Lexical Analyzer Generator in details and write a
flex program to count the words, lines, small letters, capital letters,
digits and special characters in a text file. 4(CO1)
(B2) Construct Directed Acyclic graph for the following piece of code
Repeat {
P = P + X [I] / Y [I]
Q=Q+1
}
Until Q > 100 6(CO5)
3. (A) (A1) Construct LL (1) parsing table and check whether the given grammar
is LL (1) or not
SuA
A u aB | aC | Ad | Ae
B u bBC | f
Cug 4(CO2)
(A2) Obtain LALR parsing table for the grammar and show the stack
buffer content for string "id f id"
S u LfR / R
RuL
L u * R / id 6(CO2)
OR
(B) (B1) Construct the LL (1) Parsing Table for the following Grammar
EuE+T/T
TuT*F|F
4. (A) (A1) Combine the states of the CLR parser and construct LALR parser.
S u aAd | bBd | aBe
Auc
Buc 5(CO2)
(A2) Consider the following expression P < Q or (R < S and T < U)
write translation scheme, three address code and annoted parse
tree. 5(CO3)
OR
(B) (B1) Suggest data structures that can be used to implement LL and
LR parser. 5(CO4)
(B2) Represent the expression a = (b + c) * (– c) in quadruple, Triple and
Indirect Triple Represenation. 5(CO3)
OR
(B) (B1) Write SDTS and generate TAC for the following statement, also
show the parse tree
for (i = 1 ; i <= 10 ; i = i + 1)
num = num + i ; 5(CO3)
2KTT/ARDR/ET – 12682 3 Contd.
(B2) What is an activation record ? Explain the meaning of each
entry in activation record. 5(CO4)
6. (A) (A1) What are data flow equations ? Using algorithm to compute IN
and OUT find the computation of IN and OUT. Program illustrating
definitions is as given below :
i=m–1
j=n
a = u1
do
i=i+1
j=j–1
if e1 then
a = u2
else
i = u3
while e2 6(CO5)
(A2) Explain phrase level error recovery method for LL parser by
taking an example. 4(CO4)
OR
4(CO5)
D
2KTT/ARDR/ET – 12682 4