1337 B. E. 7th Semester (CSE) Examination, December-2006 COl\WILER DESIGN Paper-CSE-:405-E Time allowed: 3 hours
Maximum marks: 100
Note:· Attempt anyfive questions. 1.
Describe different phases of a compiler with the help of a neat diagram .
2.
. . (a) Describe algorithm to convert NDFA into DrA.
(b) Construct a finite automata accepting the set of all strings of zeros and ones ; with at most one pair of consecutive zeros and at most one pair of consecutive ones. 3.
Consider the grammar S ~ (L) I a
•
L~L,S I S (a) What are the terminals, non-terminals and start symbol? (b) Find parse tree for the following sentences: (i)
(a, a)
(ii) (a, «a, a), (a, a»). (c) Construct a leftmost derivation for each of the sentences in (b) above.
1337-p-2-Q-8 (06)
P.T.G. ~
(2)
1337
(d) Construct a rightmost derivation for each of the sentences in (b) on prevo page. 4.
(a) Explain Predictive Parser. (b) Discuss Shift reduce Parsing.
5.
Show that the following grammar S ~Aal bAc I dcl bda A~d
is LALR (l)but not SLR (1). 6.
(a) What are syntax trees ? How these can be constructed? (b) What are quadruples, triples and indirect triples? Give ., examples.
7.
(a) What are symbol tables? Explain their significance. (b) Write a cietailednote on error detection and recovery.
8.
(a) Write about code optimization. (b) What is meant by register allocation ? Why is it considered to be important?
1337