CLASS ASSIGNMENT NO2-toc
CLASS ASSIGNMENT NO2-toc
THEORY OF COMPUTATION
CLASS ASSIGNMENT NO: 1
1) Explain Chomsky Normal Form (CNF)
2) Explain following :
(i) Regular Grammar (ii) Context free grammar
3) Design CFG for following language
a) L = {0i 1 j 0 k | j > i+ k
b) L = { a i b j ck | i=j or j = k }
4) For following CFG’s , describe the language it accepts
a) S SS | XaXaX | ^
X bX | ^
b) S aM | bS
M aF | bS
F aF | bF | ^
c) S aS | bS |a| b| ^
5) For below CFG find a CNF form
S AaA | CA | BaB
A aaBa | CDA | aa | DC
B bB | bAB | bb | aS
C Ca | bC | D
D bD |^
6) Prove that following CFG is ambiguous and also write unambiguous grammar for
same and draw a parse tree for string a + a * a
S S +S | S-S | S *S | (S) |a
7) Show that CFG S a | Sa | bSS | SSb | SbS is ambiguous
8) Find equivalent unambiguous grammar for following CFG
S A|B
A aAb | ab
B abB | ^
9) Explain derivation tree, expression tree and ambiguity with example
10) Convert following CFG to CNF
S AACD | ACD | AAC | CD | AC | C
A aAb | ab
C aC | a
D aDa | bDb| aa | bb
11) Give difference between top down parsing and bottom up parsing
12) Write theorem : If L1 and L2 are two context free languages , then the language L1U
L2, L1 ∩L2 and L1* are also CFLs.
13) Explain bottom up parsing with example.
14) Give transition table for deterministic PDA recognizing following language
L = { an bn+m cm | n,m ≥ 0 }