Solution (source code)

= Solution

Use $L=\{a^nb^n:n\geq0\}$. The <context-free grammar> $S\to aSb\mid\varepsilon$ generates exactly $L$, so it is a <context-free language>. It is not a <regular language>: if $p$ is a pumping length, any allowed decomposition of $a^pb^p$ has a nonempty pumped segment consisting only of $a$'s. Pumping down leaves fewer $a$'s than $b$'s, contradicting the <pumping lemma for regular languages>. Thus \b[$L$ is a <context-free language> but not a <regular language>].