ACSBS0502
ACSBS0502
ACSBS0502
Roll. No:
SECTION A 20
(a) Tokens
(b) Lines
(c) Groups
(d) Packets
(a) Bottom-Up
(b) Top-Down
Page 1 of 4
(c) Both Bottom Up and Top Down Parsing
(d) None of above
1-d. In which derivation, the Right-most non-terminal symbol is replaced at each step. (CO2) 1
1-e. Who is responsible for the creation of the symbol table? (CO3) 1
(a) Assembler
(b) Compiler
(c) Interpreter
(d) None of above
(a) Quadruples
(b) Triples
(c) Indirect Triples
(d) All of the above.
Page 2 of 4
(d) final phase of compilation
(a) Identifiers
(b) Names
(c) Constants
(d) All of the above
2.e. What are the advantages and disadvantages of register allocation and assignments? 2
(CO5)
SECTION B 30
3-a. Analyze the given expressions a:= b*c-d with different phases of the compiler. (CO1) 6
3.e. Draw the format of activation record in stack allocation and Explain each field in it. (CO3) 6
3.f. Write the Quadruples, Triples for the following expression (x + y)*(y + z) + (x + y + z) . 6
(CO4)
SECTION C 50
4-b. Define Lex and Lex specifications. How lexical analyzer is constructed using lex? Give an 10
example. (CO1)
Page 3 of 4
5. Answer any one of the following:-
5-a. What is the difference between CLR and LALR parsing? Explain using an example. 10
(CO2)
5-b. What do you understand by left factoring and left recursion and how it is eliminated? 10
(CO2)
6-a. Consider the following Syntax Directed Translation Scheme (SDTS) using below SDTS 10
construct parse tree and annotated parse tree for the expression:
"S = 2+3*4." (CO3)
E->E+T { E.val = E.val + T.val }
E -> T { E.val = T.val }
T -> T*F { T.val = T.val * F.val }
T -> F { T.val = F.val }
F -> INTLIT { F.val = INTLIT.lexval }
6-b. What is the role of symbol table ? Discuss different data structures used for symbol table. 10
(CO3)
7-b. Explain what constitute a loop in a flow graph and how will you do loop optimizations in 10
code optimization of a compiler? (CO4)
8-a. Define Directed Acyclic Graph. Write the Algorithm for Construction of DAG. For the 10
following Basic Block , Construct DAG. (CO5)
d = b * c;
e = a * b;
b = b + c;
c = b * c;
Page 4 of 4