this is the context free language I've been given:
$S\rightarrow aSTb\\ S\rightarrow b\\ T\rightarrow Ta\\ T\rightarrow \lambda $
And I want to figure out what language it represents and write the regular expression for it, including conditions that define it. So far I've come up with the following:
$L=\{w\in(aa^*b)^*a^*b| \#_b(w)\leq1+\#_a(w) \}$
where $\#_b(w)$ means the number of b's in the word.
The condition itself seems to be correct, at least for all the examples I tried. However, some words can be created with the expression I wrote but do not belong to the language. For example "aaaaabb"
I'd appreciate any help with this. Thank you
Expression $a^nb(a^{k_1}ba^{k_2}b\ldots a^{k_n}b)^n$ with $n\geq 1$, $k_1,\ldots,k_n\geq 1$.