Construct grammar given the following language!
$ L = \{(ab)^{n+1}u(ba)^n|n>0, l_c(u) = 1, u\in\{a,c,d\}^* \}$
My interpretation in a less accurate way:
- $(ab)^{n+1}$ says we need to concatenate $(ab)$ at leat one time with itself (since $n > 0$)
- $u$ represents one word from the set of $\{a,c,d\}^*$, (except the words, that contain the letter $c$ more than once). The set $\{a,c,d\}^*$ is equivalent to $\bigcup \limits _{i=0}^\infty \{a,c,d\}^i$
- $(ba)^n$ means we need to use $(ba)$ at least once.
My soloution for the rules so far:
$S\to abA$
$A\to abB|abA$
$B\to aB|dB|c|cC$
$C\to baD$
$D\to baD|ε$
Notations:
- $S$ - start variable
- $ε$ - null string, end of the word
- $l_c(u)$ - the exact numbers of $c$'s in $u$
I'm having difficulties figuring out the rule(s) for the part $l_c(u) = 1$.
I need clarification on my interpretation of the given $L$ language and thoughs how to construct the rule(s) for the part $l_c(u) = 1$.
In addition, I'm a bit unconfortable on this field, so there might be other issues too.