= Solution
\b[The <formal language> is a <context-free language>.] A <context-free grammar> with start <nonterminal symbol> $S$ is
$$
\boxed{S\to AB,\qquad A\to aAb\mid\varepsilon,\qquad B\to bBc\mid\varepsilon.}
$$
The <production rule> for $A$ nests one $a$ on the left and one $b$ on the right on each recursive use, so $A$ generates exactly $a^mb^m$ for $m\geq0$. Similarly, $B$ generates exactly $b^nc^n$ for $n\geq0$. The start <production rule> concatenates these <words>, yielding
$$
a^mb^m b^nc^n=a^mb^{m+n}c^n.
$$
Conversely, every choice of nonnegative <integers> $m,n$ is achieved by using the recursive <production rules> exactly $m,n$ times before their <epsilon productions>. Hence this <context-free grammar> generates precisely the required <formal language>, including all cases where either count is zero.
Back to article page