Tribhuvan University
Institute of Science and Technology
2075
Bachelor Level / sixth-semester / Science
Computer Science and Information Technology( CSC365 )
Compiler Design and Construction
Full Marks: 60 + 20 + 20
Pass Marks: 24 + 8 + 8
Time: 3 Hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
SECTION A
Attempt all question.
Difference between compiler and interpreter. “Symbol table is necessary component of compiler”. Justify this statement with examples.
List out the major tasks carried out in Lexical Analysis Phase. Convert the following NFA to DFA.

Differentiate between recursive descent and non-recursive predictive parsing method. Find first and follow of all the non-terminals in the following grammar.
E→TA; A→ +TA|ε ; T→FB; B→*FB|ε ; F→(E)|id
Construct SLR parse table for the following grammar
S→E
E→E+T|T
T→T*F|F
F→id
Define Syntax directed definition. Construct annotated parse tree for the input expression (5*3+2)*5 according to the following
syntax directed definition.

Differentiate between static and dynamic type checking. How can we carry out type checking for the following expression using syntax-directed defination?
S→ id = E
S→ if E then S1
S→ while E do S1
S→ S1; S2
Define three address codes. write three address codes for
S → do m = n-p while a <= b
Define code optimization. Discuss about any three code optimization techniques with example.
What is activation record? Discuss the different activities performed by caller and callee during procedure call and return.
Discuss about the different factors affecting target code generation.