Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

R384

BE/B.TECH DEGREE EXAMINATION,APRIL/MAY 2005

Sixth Semester

Computer Science and Engineering

CS337 – PRINCIPLES OF COMPILER DESIGN

Time: 3hrs Maximum:100marks

Answer ALL questions.

PART A-(10X2=20marks)

1.What are the cousins of the compiler?


2.What are the error recovery actions in a lexical analyzer?
3.What are the algebraic properties of regular expressions?
4.What is finite automata?
5.What are the goals of error handler in a parser?
6.Define Handle.
7.What is basic block?
8.What are the various ways to pass a parameters in a function?
9.How would you calculate the cost of an instruction?
10.How would you map names to values?

PART B-(5X16=80marks)

11.(i)What are the various phases of the compiler?Explain each phase in


detail.Write down the output of each phase
for the expression a:=b+c*50.(10)
(ii)Briefly explain the Compiler-Construction tools.(6)
12.(a)(i)Explain the process of constructing an NFA from a regular expression.Find
NFA for the expression
(a/b)*a(a|b)(a|b).Convert the obtained NFA into DFA.(12)
(ii)What are the issues of the lexical analyzer?(4)
Or
(b)(i)How would you construct a DFA directly from a regular expression?(10)
(ii)What are the preliminary steps that are to be carried out during parsing?Explain
with suitable example.(6)
13.(a)Construct the predictive parser for the following grammar.(16)
S->a|1^|(T)
T->T,S|S
Write down the necessary algorithms and define FIRST and FOLLOW.
Show the behaviour of the parser in the senteneces:
(i)(a,(a,a))
(ii)(((a,a),1^,(a),a).
Or
(b)(i)Check whether the following grammar is a LL(1) grammar
S->iEtS|iEtSeS|a
E->b (6)
(ii)Explain the error recovery strategies on Predictive parsing.(4)
(iii)Explain the LR parsing algorithm with an example.(6)
14.(a)(i)What is a three address code?What are its types?How it is implemented?
(10)
(ii)Explain how declarations are done in a procedure using syntax directed
translation.(6)
Or
(b)Explain the various data structures used for implementing the symbol table and
compare them.(16)
15.(a)Explain the principle sources of code optimization in detail.(16)
Or
(b)(i)What are the issues in the design of the code generator?Explain.(8)
(ii)Explain the DAG representation of the basic block with an example.(8)

----------------------------------------------------------

You might also like