Calicut University 2006 M.C.A - - Principles of Compilers - Question Paper
Third semester M.C.A Degree exam - June 200
MCA2K304 - Principles of Compilers
M06304
THRKO SEMESTER M.C.A. DEGREE EXAMINATION, Jl'SE 2006 MCA2K.W- PRINCIPLES OF COMPILERS
Max lime: 3 hrs Max Marks: 100
Answer any five questions
I (a) Explain with diagram the different phases of a compiler (15)
(b) State and explain (lie necessity of dividing the analysis phase into lexical analysis and syntactic analysis (5)
2. (a> Distinguish between a regjlur expression and context-free grammar. Write the
instruction to convert a regular expression to a context-free grammar (7)
(b) Explain leftmost derivations of a grammar. By considering Che following grammar construct a leftmost derivation of the scntsnce ( a, ( a, a ))
S - (L)|a -* L.S'S (5)
(c) Explain the role of the parser vriih suitable ciagram. Also state different Error -Recovery strategies of the parser to recover from a syntactic error. (8)
3 {a) Describe briefly (lie difficulties of the top-down parser (5)
(b) Construct IX {1) parsing iab!c for the following grammar * S ABC A a) Co r. C dA e C e)f
S iC'tS S * iCtScS S a C b (b) Show that toe following grammar
S - Aa | bAc | dc I bda A * d
is LALR(l) (15)
5 (a) Explain Annotated Parse Tree. Construci an Annotated Parse Tree for the following
grammar on inpul 101.101
S L.LJL 1 l.B| B B - 0|] (7)
(b)(5) Explain Syntax-Directed Definition by specifying its form (5) (ii) What is ar. S-attrihuted Definition? Ixpbin the different data structures usee in
the bottom-up evaluation ol'S-atiribjted definition. (5)
(c) Explain Dcpcndency Graph by taking suitable example. (3)
6 (a) Explain the necessity of generating intermediate code instead of generating the
target code directly (5)
(b) State different techniques that arc used in the implementation of three-address code with example. Abo give the comparison between these methods. (15)
7. fcpiainvarXHjt code optimization techniques with examples (20)
Attachment: |
Earning: Approval pending. |