I was wondering how to determine (with proof) whether the context-free language generated by the following context-free grammar $G$ is regular, where $S$ is the start variable and $a$, $b$ are the non-terminals.
$G:\ S\to aABb,\ A\to BAS \mid\epsilon,\ B\to a \mid b.$
It doesn't seem easy to determine exactly what set of strings the given language represents (e.g. there isn't some description like $\{a^i b^i : i\ge 0\}$ or the complement of some set that's easy to describe without explicitly listing the rules of a CFG).
The strings of $G$, where $G$ is the context-free grammar, seem to always end in some number of $Bb$'s and start with some number of $A$'s. Obviously every generated string must end in a b. There might be some relationship between the number of a's and b's of the language (e.g. maybe if a b appears then a certain number of a's must follow the b. The intuition is that the grammar doesn't generate strings with too many b's).
I think the language might be non-regular; the rules don't look like they'll translate to a regular expression easily. Two ways of showing a language is nonregular is to show that it fails the pumping lemma or it has infinitely many equivalence classes. Suppose $n$ is a pumping length for the language. The string $a(a^{3n} b^n)ab$ is in the language for every $n\ge 0$. It seems hard to verify whether a string is not generated by the grammar in cases other than the obvious ones (e.g. $b$ is not at the end of the generated string).