Tribhuvan University
Bachelor of Science in Computer Science and Information Technology
Semester 6 · TU Board 2081 (new course)
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 any TWO question.(2 × 10 = 20)
- 1.10
Discuss about Directed Acyclic Graph with an example. Represent the expression A = (B + C) – (D – E) using 3AC, Quadruple and Triple.
- 2.10
Create the LR(1) parsing table for following grammar.
S → AA
A → 0A
A → εAnswer comingAlso asked in 2081, 2080, 2076, 2075
- 3.10
Explain the optimization techniques for code optimization. Convert the following program to basic block and control flow.
M = A + B
N = C + D
IF (M > N)
X = M – N;
ELSE
E = M + N + X
Group B
Attempt any EIGHT question.(8 × 5 = 40)
- 4.5
Compute the FIRST and FOLLOW of all the non-terminals in following grammar.
S → AB
A → 0A' | 1A' | ε
A' → SSA' | ε
B → AS | 1Answer comingAlso asked in 2081, 2080
- 5.5
What are the operations performed in symbol table? Discuss about activation tree.
- 6.5
What are the roles of macros and preprocessor? Discuss about one pass and multi pass compiler.
- 7.5
Define explicit and implicit type conversion. Why do we need to check type of the system? Justify with an example.
- 8.5
Differentiate between synthesized and inherited attributes with example.
Answer comingAlso asked in 2081
- 9.5
Construct the LL(1) parsing table for the following grammar.
S → AS1 | C
A → 0
C → 2C | εAnswer comingAlso asked in 2081, 2080, 2076, 2075
- 10.5
What are the advantages of intermediate code? How do you convert procedure call to 3AC?``
- 11.5
What is a symbol table? Discuss the general structure of an LR parser.
- 12.5
Generate the LR(0) item sets for the following grammar.
A → BB
B → bB | aAnswer comingAlso asked in 2081
— The End —