Kerala University 2008-6th Sem B.Tech Information Technology Compiler Design - Question Paper
constants in C. (including octal, hex, signed do) Construct the corresponding DFA. b) Show that if L is regular, so are the languages
i) &qrt (L) { jJ for some y with I y I IxI*,xy Is InL}
ii) Log (L) {x/ for some y with I y I 2 1x1, xy is to L}
12. a) la the following grammar ambiguous ? why? 8->aB/bA A -* a t aS / bAA B - b I bS / aBB
b) Show that every CFL without is generated by a CFG all of |
whose productions are of the form A- a and A-* a a b.
Module >11
13.a) la the following grammar LL (1)? Why? If ft it not, conven Start -* Symbol Rest / TT Rest / Sllit Rest SHit- Slist &/t Symbol Rest -* AT.
b) Show that no LL (t) grammar can be ambiguous. 14j) Wriie a ptocodue for delecting unreachable entries iq operator precedence a/td LR parsing tables, b) Show tfaaKverygrammer can be converted into so e operator grammar.
15. a) Write a code generation schema for swilcb staieovt b)Ez]dain various loop optimiarioAs possible using flow
16. a) Show how code general ion for Boolean expressions
okadral wirtwne can be done in one pMs. b) Construct a syDU*-directed definition that generate*1 addres code for for*$ttieinem in C
Modak-lll
I.H)
3810
SEMESTER B.TBCH DEGREE EXAMINATION JULY 2001 (2003 Scheme)
03. J: COMPILER DESIGN (R)
Utoun Mu Muts:100
PAKT-A
Aifwer aH qmtknu. Eld tirritt 4 mftrtts.
| fl**rti*ic(omp:lenand hiterpretm.
M tal ** totow end coftWuct (he a$iodued symbol cable for (he
[ Mb'** *MMlr merer*.
H && A < 2*C -10) do A HtC
Http* v i if mhI* (i ipplled for code Optimisation? Why Justify
IH # I* 7 Mow ie d* bootttrappeg conv
*fbi xninnul fim md Ieft sentential form, ibvhenli* pnvni?
I Jt
7. Give the roles to construct LEADING and TRAILING for and operator precedence grammar.
S. Translate the following expression to Quadruples and Triples.
(ft + b) (c - d) + (a + b c)
9. Identify tut sources ofeemantic errors. What kind of recovery methods are used here?
10. How can basic blocks be identified?
PtrtB Module I
U, a) Explain the need of token recognizer. Show bow an input buffe can be used for token recognising. b) Give the NFA construction algorithm from a regular expns&a'oaj Apply the algorithm to find NFA for the following reguli expression a(a b) * ab (a I b)* a.
OR
12. a) What is an ambiguous grammar? With an example, illustrate bow)
we can not uniquely parse a given sentence for an ambiguouij grammar.
b) Check whether the regular expression (al b) (aib I Ol I)* and context free grammar, saA/bA.A&A/bA/Oi/lA/denote same language or not
c) Can a palindrome be represented by a regular expression? Juitil your answer.
Module U
13. a) Define FIRST and FOLLOW clearly. Explain the algorithm w
coretntct predictive parsing table. Write the algorithm fur predl passing program.
b) Illustrate the above operations by faking a sample string for the grammar,
E -+ TE\ E' = TE'/e : T -> FT T - FTV8
* F (E)/id
OR
14. ) Define a configuration for LR parsor show the configuration for various values in the Action entry,
h) Illustrate the aJgorithm to construct an SLR psuymg table. Module m
M i Wm le abort notes on:
0 Back patching li) Loop unrolling III) Induction variable elimination.
Iv) Inherited and Synthesised Translation.
OR
in detail, any three methods of code optimisation, ahnrt notes on peephole optimisation.
Attachment: |
Earning: Approval pending. |