If you settle for a noncontracting (or monotonic) grammar instead: $S\to DTA \mid ab$ $~~~~~$ the last $A$ is an end-marker for the last $ab^n$, $n=1$ separate. $T\to DTa \mid Da$ $~~~~~$ number of $D$'s equals the number of $a$'s ($A$ counts as $a$) $Da \to abD$ $~~~~~$ every $a$ gets an extra $b$ $Db \to bD$ $~~~~~$ $D$ moves over $b$'s $DA \to Ab$ $~~~~~$ and $D$ disappears at the last block of $ab^n$ $A \to a$ $~~~~~$ finally end-marker $A$ is changed into $a$ (if we do this too soon, the $D$'s will not disappear, and the dirivation is not valid)