LearnCSIT
Tribhuwan University
Institute of Science and Technology
Model
Bachelor Level/ sixth Semester/ Science
B.Sc.CSIT
Compiler Design and Construction
Full Marks: 60
Pass Marks: 24
Time: 3 hours
Candidates are required to give their answer in their own words as far as practicable.
The figures in the margin indicate full marks.
Section A
Attempt any TWO questions
1.
Differentiate between top-down and bottom-up parsing methods. Construct SLR parse table for the following grammar.
S-> aETe
E-> Ebc
E-> b
T-> d
2.
What are static and dynamic type checking? Write SDD to carry out type checking for the following expression.
E-> id | E1 op E2 | E1 relop E2 | E1[E2] | E1↑
3.
What is the role of intermediate code generation in the entire compilation process? Convert the following into three address code.
a+(b-c)*d
Section B
Attempt any EIGHT questions
4.
Define compiler. Explain analysis phase of compiler.
5.
"Symbol table is necessary component of compiler", justify this statement with examples.
6.
Given a regular expression (e + 0)*10. Construct the DFA recognizing the pattern described by this regular expression using syntax tree based reduction.
7.
Define the terms token, pattern and lexeme. How input buffer can be used for scanner. Explain.
8.
Find first and follow of all the non terminals in the following grammar.
E→TA ; A→+TA | e ; T→FB | e ; F→(E) | id
9.
What is Syntax Directed Definition? Define synthesized and inherited attributes with example.
10.
What do you mean by runtime storage allocation? Differentiate static and dynamic allocation.
11.
Why is it necessary to optimize code? Explain any two code optimization techniques with example.
12.
Explain about the factors affecting code generation.