Construct contextfree grammars that generate the following l
Construct context-free grammars that generate the following languages. In all cases, sigma = {0, 1}. middot {0^2n1^n: n greaterthanorequalto 0} {w: w contains at least three 1s} {w: the length of w is odd and its middle symbol is 0}
Solution
Answer:
1. S->A|epsilon
A->00AB|001
B->1
2.
X Y1Y1Y1Y
Y 0Y | 1Y | epsilon
3.
S 0S0 | 0S1 | 1S0 | 1S1 | 0
