I.
Assignment # 7
Describe the languages generated by:
a. $S \rightarrow ASA \mid A \mid \varepsilon$
$A \rightarrow 00 \mid \varepsilon$
b. $S \rightarrow 0S1 \mid SS \mid \varepsilon$
c. $S \rightarrow TOT$
$T \rightarrow TT \mid 0T1 \mid 1T0 \mid 0 \mid \varepsilon$
II.
Consider the following context free grammar: G = ({S, A, a, b}, {a, b}, R, S), where R = {
$S \rightarrow aAS$
$S \rightarrow a$
$A \rightarrow SbA$
$A \rightarrow SS$
$A \rightarrow ba$ }
(a) Answer each of the following questions True or False:
(i) From the fact that G is context free, it follows that there is no regular expression for L(G).
(ii) L(G) contains no strings of length 3.
(iii) For any string w \in L(G), there exists u, v, x, y, z such that w = uvxyz, $|vy| \ge 1$, and $uv^nxy^nz \in L(G)$ for all n \ge 0.
(iv) If there exist languages L1 and L2 such that L(G) = L1 \cup L2, then L1 and L2 must both be context free.
(v) The language $(L(G))^R$ is context free.
(b) Give a leftmost derivation according to G of aaaabaa.
(c) Give the parse tree corresponding to the derivation in (b).
III. Convert to Chomsky Normal Form:
$S \rightarrow AbA$
$A \rightarrow Aa \mid \varepsilon$