Context-free grammar producing a certain language

56 Views Asked by At

Is it possible to find a context-free grammar producing all words of form $a^nb^n a^n$, where $n \ge 0$? This question came up when I was trying to construct a grammar producing $\left\{ a,b \right\}^* - \left\{a^nb^n a^n: n\ge 0 \right\}$, which turned out to be a fairly easy task. Any hints greatly welcomed.