# CFG for a given languague

Give a CFG for the languague L = $$\{ 1^n +1^m = 1^{n+m}| n,m \in N_{0}\}$$ , with the alphabet $$\Sigma =\{1,+,=\}$$.

I am currently trying to solve the given task, I thought a good way is to split the Languague into two more simple languagues, but I am keep failing. May some can help

The idea is to start generating the ones of the first addend from the axiom $$S$$, while simultaneously adding the corresponding number of ones at the end of the sentential form. Then you have a production from $$S$$ to non-terminal $$A$$ which takes care of generating the second added, while still appending ones at the end of the sentential form.
When you are done generating the second addend you can replace $$A$$ with $$=$$ in order to split all the ones from the two addends (on the left side) from the corresponding number of ones on the right size.
\begin{align*} S &\to 1S1 \mid +A \\ A &\to 1A1 \mid \,= \end{align*}
• Why not? Here is an example where $n=0$: $S \to +A \to +1A1 \to +1=1$. Here is an example where $m=0$: $S \to 1S1 \to 1+A1 \to 1+=1$. Here is an example where $n=m=0$: $S \to +A \to +=$. May 23 '20 at 12:40