CD1

You might also like

Download as pdf
Download as pdf
You are on page 1of 2
[LU] 10CS63 Sixth Semester B.E. Degree Examinatiou, June/July 2015 Compiler Design & ‘Time: 3 hrs. Max, Marks:100 Note: Answer any FIVE full questions, selecting atleast TWO questions from each part. | PART-A 21 & Explain with 4 diagram, the phases of complier. ¢ (08 Marks) j bb. Write regular definitions forthe following using extended engsiorein notation : p ‘identifier - 3 ii) unsigned number. (06 Marks) 1s ‘c. Write a program for look ahead code with sentinels, “1? {06 Marks) ii 2a Define left recursive grammer. Eliminate left fecision from the following grammer: BokR+T|T 9 5 | TITRE . i F—>(&)|id, Ww 405 Marks) b. Given the grammer: YL i S-> AaAb| BbBa < z Ave h Boe compute FIRST ) and FOLLOW( ) functions § i i) construct predictive parsing table parse the inpyt string w = ab, (09 Marks) . €. Show that the following grammer is ambigious E> E + E | E * E | (E) | id, write an t ‘equivalent yn-aimbigious grammer for the same. (6 Marks) i i 3) a What is meant by handle pruning? construct Bottom ~ up parse tree for the input string :f ve aaa ¢ a ++. Using the grammer : gs pSass4ss- 1a (06 Marks) ZX?” Eaplan he working of shit reduce parser. Parse the input string id + id. Using the grammer 3S) of question no, 2a 108 Marks) OF © With a diagram, explain the mode! of an LR parser. (06 Marks) aa 4 & White an algorithm to consruct LALR parsing table. (06 Marks) Z 'b. Construct the parsing table for LALR(1) parser using the grammer : sec Cac Coa. 10 Marks) Compare LALR and canonical LR parsers, (04 Marks) & co ose 10cs63 PART-B Explain the concept of syntax directed definition (04 Marks) Consider the context free grammer given below : < SEN o ESE+T|E-T|T ~ ToT+k|VE|F ~- FE) | digit x No: i) Obtain SDD forthe above grammer “ ii) Annotated parse tree forthe input string 5 « 6 +7, (10 Marks) Define i) Synthesized attribute Inherited attribute (06 Marks) Construct DAG and three address code forthe felons expression : atarb-c+(b-ced. (08 Marks) Explain the following with an example : i) ii) ples, (08 Marks) ‘Generate three address code forthe follow Ht ‘switch (ch) © Lease Liem a+b; break; = > ease 2:e=a—b; break; = <7 ’ 7 (04 Maris) With a neat diagram, defeiibe the general structure of an activation record (06 Marks Explain in the stra reducing fragmentation in heap memory, (08 Marks) Explain tty af perme metrics to be considered while designing a garbage collector. s\' (06 Marks) Discuss the various issues in the design of a code generator. (10 Marks) ‘What-are basic blocks and flow graphs? Write an algorithm to partition the three address {instructions into basic blocks. (06 Marks) List the characteristics of a peephole optimization, (04 Marks) 2of2

You might also like