Design For Accessibility: Getting it right from the start
Assigment cd1
1. ALPHA COLLEGE OF ENGINEERING &TECHNOLOGY
DEPARTMENT OF COMPUTER ENGINEERING
ASSIGNMENT: 1
COMPILER DESIGN (170701)
B.E. – 7TH
SEM CLASS: CE
LAST DATE OF SUBMISSION: MARKS: 10
1) What are phases of a compiler? Explain the function of each phase with example.
Symbol table is necessary for compiler construction; justify your statement with example.
2)
a) Design a DFA which accepts set of strings such that every string containing 00 as
a substring but not 000 as substring.
b) Construct a FA that will accept those strings of a binary number that are
divisible by three.
c) Build an FA that accepts the words baa, ab and add and no other string longer or
shorter.
d) Write English descriptions for the languages generated by the following regular
expressions: (a | b)* a(a | b | ε)
3)
a. Test whether the following grammar is ambiguous
i. L L ; L | S
ii. S a
b. Eliminate all productions from the following grammars
i)
S aAB | dA
A bAc |
B dB |
ii)
S ABAC
A aA |
B bB |
C C
4)
a. Identify and remove unit productions from the following grammars
2. ii) S A | bb
A B | b
B S | a
iii) S AB
A a
B a | b
C a
D a
E a
b. Remove the useless symbol from the following grammars
i)S aB | bX
A BAd | bSX | a
B aSB | bBX
X SBD | aBx | ad
ii) A xyz | Xyzz
X Xz | xYx
Y yYy | XY
Z Zy | z
NOTE: PROVIDE MODERATE NO OF QUESTIONS
FACULTY NAME: Shraddha Patel