Question Paper Details:
University: Rajasthan Technical University
Course: B.Tech Computer science & engineering
Subject: Compiler Construction
Exam Year: Nov-Dec 2011
Year or Semester: Fourth year/ Seventh Semester
Paper Code: 7E4239
Unit-1
Course: B.Tech Computer science & engineering
Subject: Compiler Construction
Exam Year: Nov-Dec 2011
Year or Semester: Fourth year/ Seventh Semester
Paper Code: 7E4239
Unit-1
1. a) Explain the different phases of compiler design with the help of suitable diagram. [ Marks 8]
b) Explain the following terms
i) Translators, compiler and interpreters
ii) Bootstrapping [Marks 2+2]
c) Illustrate the translation of the following statement on all phases of compiler
a:=b*c+d/e [Marks 4]
OR
a) Write short note on “Input Buffering” [Marks 2]
b) Construct minimum state DFA for the following regular expression. [Marks 6]
b(a/b)* a
(a/b)* a(a/b) (a/b)
((a/b)/(b/c))*
c) What is role of lexical analyzer? [Marks 2]
d) Define the term NFA and DFA with an example. What are the rules to get a NFA for a regular expression? And also describe the application and limitations of finite automata. [Marks 6]
Unit-II
2. a) Consider the following grammar G:
E-> TE’
E’->+TE’/ €
T->FT’
T’->*FT’/€
F->( E ) /id
Where € denotes the empty string of symbols
i) Compute FIRST and FOLLOW for each non terminal of the grammar G.
ii) Construct a predictive parsing table for grammar G. [Marks 3+3]
b) What do you mean by context free grammar? Give distinction between regular and context free grammar and limitations of context free grammar. [Marks 4]
c) Show whether the following grammar is LL(1) or not
E->TE/+TE/€
F->FT/*FT/€
F->( E ) /id
And explain the model of a predictive parser. [Marks 3+3]
OR
2 Explain Top down and Bottom up parsing techniques in detail. [Marks 16]
Unit-III
3. Write a program to translate an infix expression into postfix form. Also write syntax directed definition for the same. [Marks 16]
OR
3 a) Define syntax directed definition. Explain the various forms of syntax directed definition. [Marks 10]
b) Write specification of a simple type checker with example. [Marks 6]
Unit-IV
4. a) Write short notes on
i) Activation Record
ii) Parameter passing [Marks 6*2]
b) Differentiate between stack and heap allocation. [Marks 4]
OR
4 a) What are various Runtime storage Management techniques? Explain with programming examples. [Marks 10]
b) Write short note on symbol table. [Marks 6]
Unit-V
5. a) Construct the DAG and generate the code for given block. [Marks 8]
d:=b+c
e:=a*b
b:=b-c
a:=e*d
b) Write short not on code optimization and DAG. [Marks 8]
OR
5 Construct the tree for following expression and apply labeling algorithm for optimal ordering x*(y+z)-z/(u-v) [Marks 16]