Answer All Questions, Each Carries 3 Marks.: Ɛ Ambiguous? Justify Your Answer
Answer All Questions, Each Carries 3 Marks.: Ɛ Ambiguous? Justify Your Answer
PART A
Answer all questions, each carries 3 marks. Marks
1 Draw the transition diagram for the regular definition, (3)
relop< | <= | = | <> | >= | >
2 With an example source language statement, explain tokens, lexemes and (3)
patterns.
3 Define LL( 1) grammars. (3)
4 Is the grammar SS(S)S/ Ɛ ambiguous? Justify your answer. (3)
PART B
Answer any two full questions, each carries 9 marks.
5 a) Apply bootstrapping to develop a compiler for a new high level language P on (3)
machine N.
b) Now I have a compiler for P on machine N. Apply bootstrapping to obtain a (4)
compiler for P on machine M.
c) Define cross-compilers. (2)
6 a)
Consider the following grammar
E E or T | T
T T and F |F
F not F | (E) | true | false
(2)
(i) Remove left recursion from the grammar. (4)
(ii) Construct a predictive parsing table.
(iii) Justify the statement “ The grammar is LL (1)”. (3)
7 a) Design a recursive descent parser for the grammar ScAd, Aab/ b (5)
b) For a source language statement a= b*c - 2, where a, b and c are float variables, (4)
* and – represents multiplication and subtraction on same data types, show the
input and output at each of the compiler phases.
PART C
Answer all questions, each carries 3 marks.
8 Compute the FIRST and FOLLOW for the following Grammar. (3)
Page 1 of 2
B B6815 Pages: 2
Page 2 of 2