Rajasthan Technical University 2009-8th Sem B.E B.Tech (Main/Back) Compiler construction - Question Paper
Rajasthan tech. University
B.E. eight sem (Main/Back)
Compiler construction
Paper I
IV B.E. (VIII SEMESTER) (MAIN/BACK)
V, EXAMINATION, 2M9
(New Four Year Semester Scheme)
{Branch: Computer Engineering]
Paper I '
Time Allowed : Three Hours Maximum Marks 80
(1) N'. supplementary answer-book will be given to any candidate. Hence the candidates should write the answer precisely in the Main answer-book only.
(2) All the parts of one question should be answered at one place in the answer-book. One comptet, question should not be answered at different places in the answer-book.
Attempt any five questions.
All questions carry equal marks.
lum nver
1. (a) Explain the different phases of compiler design
with the help of suitable diagram. . 8
(b) What is the role of lexical analyzer? How does lexical analyzer remove white spaces from a source file? 8
2. (a) Show whether the following grammar is ' ' (1) or
not: ,
ETE\+TE\ T-*FT\*FT\e
(b) Consider the following grammar to declare a list of variables:
D -> type list; type-* int | float list -* id tlist tlist id tlist | e
(z) Construct the first and follow sets.for tiie grammar.
(ii) Construct a predictive parsing table for the grammar. 12
3. (a) Write a program to translate an infix expression
into postfix form. Also write syntax directed definition for the same. 10
(b) Write the specification of a simple type chccker with example. , 6
SI 26 2
4. (a) Define L-attributed definition. Construct the
parse tree for expression 9-5+3 using following translation scheme:
E-~TR
R -* addop T {print (addop.lexeme)} /?t |e T -* num { print ( num.\al)} 8
(b) Translate the expression
.4 = -fl*(C+>)/ into Quadruples and Triples representation. 8
5. Consider the following program segment:
begin
prod : = 0 ; i : = 1; do begin
prod : = prod + a [ ij * b [ i ] ; i := i +1; end
while (i<= 20)
end
(assume 4 bytes per word)
Find the basic blocks and construct the flow graph. Optimize the code by applying function preserving transformations. 16
6. Explain the following:
(a) Storage allocation strategies
(b) Activation record
(c) DAG (Directed acyclic graph)
3126
3
Turr\ ever
id) Ambiguous grammar. - -.4x4
7. (a) What arc the various runtime storage
management techniques? Explain in detail with
programming example. 8
(b) Explain the target machine with their instruction cost. 4
(c) What do y&ii mean by type system and type ' expression? 4
8. Write shprtaotes. on:
(i) Ambiguous grammar
(ii) Loop optimization
(tit) Input buffering - -
(tV) Symbol table. 4x4
SI 26 4 3.500
Attachment: |
Earning: Approval pending. |