Bachelors Level/Third Year/Sixth Semester/Science csit/sixth semester/compiler design and construction/syllabus wise questions

B.Sc Computer Science and Information Technology

Institute of Science and Technology, TU

Compiler Design and Construction (CSC376)

Year Asked: 2078, syllabus wise question

S1
1.
Define compiler and differentiate it with an interpreter. [5]
2.
What are the typical entries made in symbol table? Explain. [5]
3.
List out different types of run time storage management techniques. Explain any one of them. [5]
S2
1.
List out the tasks performed by Lexical Analyser. Define DFA. Convert the Regular Expression $(a+b)^*a(a+b)$ to DFA directly. [10]
2.
Differentiate between LR(0) and LR(1) algorithm. Construct LR(1) parse table of the following grammar.

$S \rightarrow AA$

$A \rightarrow aA | b$
[10]
3.
Define type checking. Differentiate between type casting and coercion? Write SDT to carry out type checking for the following expression.

$E \rightarrow n \mid E * E \mid E == E \mid E[E] \mid E \uparrow$
[10]
4.
Define Left recursive grammar. Remove left recursion from the following grammar.

$S \rightarrow SB | Ca$

$B \rightarrow Bb | c$

$C \rightarrow aB | a$
[5]
5.
What are the disadvantages of shift reduce parsing. Perform shift reduce parsing of string w = (x-x). (x/x) for given grammar.

$E \rightarrow E-E | E/E | (E) | x$
[5]
6.
Define attribute grammar with example of inherited and synthesized attributes. [5]
S3
1.
Define three address codes. Write down Quadruples for:

$a = -b*(c+d)/e$
[5]
2.
What is the advantages of code optimization? Explain about dead-code elimination. [5]
3.
Explain about the factors affecting target code generation. [5]