# CFG for a language: {$0^n1^{2n}01|n\in\mathbb{N}$} [duplicate]

I'm trying to come up with a CFG for a language: {$0^n1^{2n}01|n\in\mathbb{N}$}

I tried doing:
$A\rightarrow\epsilon$
$A \rightarrow A10$
$S \rightarrow A01$

It only worked for {01, 01101} but doesn't work for the other cases. Can someone help me?

## marked as duplicate by D.W.♦Aug 8 '16 at 5:01

• Let me start from $S\rightarrow A01$, it is nice to start from $S$, easier to read. Now you have to enforce twice $1$ as $0$, so $A$ should produce for example $\epsilon$ (to give 0 repeats or to terminate repeating)and $A$ produces 011, and when there are more repeats it should expand, do you know how? – Evil Aug 8 '16 at 3:51