You are on page 1of 2

Code No: 55211/MT

NR
M.Tech. – II Semester Regular Examinations, September, 2008

COMPILER DESIGN
(Computer Science)

Time: 3hours Max. Marks:60

Answer any FIVE questions


All questions carry equal marks
---

1.a) Describe how Lex generates a scanner for a TINY language.


b) Describe the steps involved for creating a lexical analyzer with Lex.
c) Explain the boot strapping process. What is the advantage of using
this process?

2. Formulate a parsing table for the simple LL(1) grammar who


productions are
S → aS
S → bA
A→ d
A → ec A
Using this parsing table give
i) A trace of the parse for the input string aabccd#
ii) A parsing function for the LL (1) grammar

3. Give the grammar whose rules are


0) G → S i) S → E = E
ii) S → f iii) E → T
iv) E → E + T v) T → f
vi) T → T ∗ f
with vT = vT = { f , +, ∗, =}.
Construct
a) The LR (1) set of items
b) Obtain LALR (1) parser from the result of (a).
c) Parsing functions for LALR (1) grammar

4.a) What is meant by semantic analysis? What are the additional


specifications of an attributed translation grammar over
translation grammars?
Write an attribute grammar for the integer value of a number given
by the following grammar.
Number → digit number|digit
Digit → 0|1|2|3|4|5|6|7|8|9.
Contd….2.
Code No: 55211/MT ::2::

b) Describe the procedure for conversion of popular programming


language constructs into intermediate code form.

5.a) What is the perspective and motivation of use of symbol Tables.


b) When a symbol table has to be constructed and table handling
routines are invoked.
c) What are the contents of a symbol table?
d) What operations are performed on symbol tables?

6.a) Describe the generic issues in the design of code generators.


b) Describe the steps involved in structure-preserving transformation
that can be applied to basic blocks.

7.a) What is Folding? What is the effect of the associativity and


commutativity rules on constant propagation? Explain with an
example.
b) Describe some important code improving transformations.

8. Write short notes on:


a) Global optimization through flow graph analysis
b) Loop unrolling.

^^^

You might also like