I have an interest in computing and want to learn more about the actual theory behind it. Context Free Grammar plays a part and I am quite fascinated by it all.
However, I came with a language that looks like this... $\{a^{x + y} b^y c a^x | x, y \ge 0\}$
I have a CFG that looks like this...
S -> XY
X -> ab | a
Y -> cYa | ε
However, I believe it is incorrect, because there can only be one instance of c. How can I correct the CFG? How do you go about writing CFG's, especially this one -- so that I know or better understand how to write more complex ones
Would really appreciate it if someone could help me out here
HINT: Have a non-terminal symbol $X$ that generates words of the form $a^mXa^m$ for $m\ge 0$ and then turns into $Yc$. Then have $Y$ generate words of the form $a^nb^n$ for $n\ge 0$. The end result will be words of the form $a^{m+n}b^nca^m$.