Language of context-sensitive grammar I have the following context-sensitive grammar:

$$
\begin{align*}
&amp;S \to xSy \mid a \mid b \\
&amp;Xa \to aa \\
&amp;Xb \to bb \\
&amp;Y \to a
\end{align*}
$$

I know what it does, as it always ends in $a$ and is preceded by 3 $a$s or 3 $b$s. I'm just not sure how to write this in set notation and would appreciate any help. Would it be something like this?
$$ L = \{a^n,b^m \mid n \ge 1, 0 &lt; m \le 3 \} $$
There are basically two possible types of derivations:


Ones that start $S \to^* X^naY^n$.
Ones that start $S \to^* X^nbY^n$.


Derivations of the first type will produce $a^{2n+1}$, those of the second type will produce $b^{n+1} a^n$.