LearnCSIT
Tribhuwan University
Institute of Science and Technology
2078
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.
List out the tasks performed by Lexical Analyser. Define DFA. Convert the Regular Expression (a+b)
*
a(a+b) to DFA directly. (3+1+6)
2.
Differentiate between LR(0) and LR(1) algorithm. Construct LR(1) parse table for the following grammar. (3+7)
S->AA
A->aA | b
3.
Define type checking. Differentiate between type casting and coercion? Write SDD to carry out type checking for the following expression. (1+3+6)
E-> n | E * E | E == E | E[E} | E↑
Section B
Attempt any EIGHT questions
4.
Define compiler and differentiate it with an interpreter.
5.
What are the typical entries made in symbol table? Explain.
6.
Define Left recursive grammar. Remove left recursion from the following grammar.
S→SB | Ca
B→Bb | c
C→aB | a
7.
What are the disadvantages of shift reduce parsing. Perform shift reduce parsing of string
w = (x-x) - (x/x) for given grammar
E→E-E | E/E | (E) | x
8.
Define attribute grammar with example of inherited and synthesized attributes.
9.
Define three address codes. Write down Quadruples for
a = -b*(c+d)/e
10.
List out different types of run time storage management techniques. Explain any one of them.
11.
What is the advantage of code optimization? Explain about dead-code elimination.
12.
Explain about the factors affecting target code generation.