Converting Context Free Grammar to Chomsky Normal Form This is an exercise that I had to complete in my class and I struggled a lot with it 
$$\begin{align*}
&S\to 0A0\mid 1B1\mid BB\\
&A\to C\\
&B\to S\mid A\\
&C\to S\mid\epsilon
\end{align*}$$
Added from comments: This is what I have but I am sure it is wrong: replace epsilon productions:
$$\begin{align*}
&S\to 0A0\mid 1B1\mid BB\\
&A\to C\\
&B\to S\mid A\\
&C\to S
\end{align*}$$
replace unit productions:
$$\begin{align*}
&S\to 0A0\mid 1B1\mid BB\\
&A\to C\mid 0A0\mid 1B1\mid BB\\
&B\to S\mid A\\
&C\to S\mid 0A0\mid 1B1\mid BB
\end{align*}$$
replace mixed productions:
$$\begin{align*}
&S\to T0AT0\mid T1BT1\mid BB\\
&A\to C\mid T0AT0\mid T1BT1\mid BB\\
&B\to S\mid A\\
&C\to S\mid T0AT0\mid T1BT1\mid BB
\end{align*}$$

(a) Eliminate -productions.
Since C can produce , A can also produce , so B can produce , so S can produce .
therefore, we need to change the productions for every symbol.
S → 00 | 0A0 | 11 | 1B1 | B | BB
A → C
B → S | A
C → S
(b) Eliminate any unit productions in the resulting grammar.
We note that A, B, and C will all just produce S again. So we remove them.
S → 00 | 0A0 | 1B1 | BB
A → 00 | 0A0 | 1B1 | BB
B → 00 | 0A0 | 1B1 | BB
C → 00 | 0A0 | 1B1 | BB
(c) Eliminate any useless symbols in the resulting grammar.
The variable C has now become unreachable. We also remove A and B, because they
are exactly equal to S. Our grammar becomes:
S → 00 | 0S0 | 1S1 | SS
(d) Put the resulting grammar into Chomsky Normal Form.
To make this a CNF grammar, we first create variables A → 0 and B → 1. We then
divide the two productions of length 3 using variables C and D.
Our final CNF grammar is:
S → AA | AC | BD | SS
A → 0
B → 1
C → SA
D → SB
