Tribhuvan University
Bachelor of Science in Computer Science and Information Technology
Semester 6 · TU Board 2075
Course Title: Compiler Design and Construction (CSC365)
Full Marks: 60Pass Marks: 24Time: 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.
Group A
Attempt all question.
- 1.
Difference between compiler and interpreter. "Symbol table is necessary component of compiler". Justify this statement with examples.
- 2.
List out the major tasks carried out in Lexical Analysis Phase. Convert the following NFA to DFA.
[figure in the original paper]
- 3.
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
- 4.
Construct SLR parse table for the following grammar
S→E
E→E+T|T
T→T*F|F
F→id
Answer comingAlso asked in 2081, 2080, 2076
- 5.
Define Syntax directed definition. Construct annotated parse tree for the input expression (5*3+2)*5 according to the following
syntax directed definition.[figure in the original paper]
Answer comingAlso asked in 2076
- 6.
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
Answer comingAlso asked in 2076
- 7.
Define three address codes. write three address codes for
S → do m = n-p while a <= b
- 8.
Define code optimization. Discuss about any three code optimization techniques with example.
- 9.
What is activation record? Discuss the different activities performed by caller and callee during procedure call and return.
- 10.
Discuss about the different factors affecting target code generation.
Answer comingAlso asked in 2076
— The End —