I'm trying to come up with a context-free grammar for the following language:
$$L = \{a^mb^nc^{m+n}\mid 0 \le n \le m\}$$
My thinking is that i can rewrite this to
$$L = \{a^mb^nc^nc^m\mid 0 \le n \le m\}$$
and then create the grammar
$$ \begin{align*} S &\rightarrow aSc \mid B\\ B &\rightarrow bBc \mid \epsilon \end{align*} $$
The problem is that this grammar doesn't capture $0 \le n \le m$ and I can't figure out how to do this. Any help would be greatly appreciated.