Languages and Grammar (Finding a language) I have a trivial question (that I have actually solved, hopefully) although I am a bit curious if my result is alright.
We have $N= \{S , C ,D\}$, $T=\{c, d\}$ and $P = \{S \to Dc, D \to Dd, D \to Cd, C \to Cc, C \to c\}$
I have tried this and my answer for this is $L(G)= c^{m+1} d^{m+1} c$, for $m \geq 0$.
So there was a friend of mine and we talked about this, and he told me that he could create the word $cdddc$, and he told me that he was very sure about it!!! I really think that he is wrong, because from my $L(G)$ it isn't possible to create this word!!
Opinions? 
 A: You have the following productions:
$$\begin{align*}
&S\to Dc\\
&D\to Dd\mid Cd\\
&C\to Cc\mid c
\end{align*}$$
Clearly any derivation must begin $S\Rightarrow Dc$. You can now apply the production $D\to Dd$ any non-negative number of times; if you apply it $n$ times, you have
$$S\Rightarrow Dc\Rightarrow^n Dd^nc\;.$$
Eventually, however, you must apply $D\to Cd$, in order to reach a terminal word:
$$S\Rightarrow Dc\Rightarrow^n Dd^nc\Rightarrow Cd^{n+1}c\;.$$
Now you can apply $C\to Cc$ any non-negative number of times, followed by $C\to c$, at which point the derivation must cease. Suppose that you apply $C\to Cc$ $m$ times; then your derivation is
$$S\Rightarrow Dc\Rightarrow^n Dd^nc\Rightarrow Cd^{n+1}c\Rightarrow^m Cc^md^{n+1}c\Rightarrow c^{m+1}d^{n+1}c\;.$$
In other words, $$L(G)=\{c^md^nc:m,n\ge 1\}\;,$$ the set of words consisting of a string of one or more $c$’s followed by a string of one or more $d$’s followed by a single $c$. A regular expression corresponding to this language is $cc^*dd^*c$; if you use extended regular expressions and allow the plus operator, you can write it $c^+d^+c$.
In particular, $cdddc\in L(G)$.
Your description of $L(G)$ implies that the productions $D\to Dd$ and $C\to Cc$ are applied the same number of times, which need not be the case. In fact, your language is a context-free language that is not regular, while your grammar is definitely a regular grammar.
