0
$\begingroup$

This question already has an answer here:

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?

$\endgroup$

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ 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? $\endgroup$ – Evil Aug 8 '16 at 3:51
  • 1
    $\begingroup$ Welcome to CS.SE! See cs.stackexchange.com/q/18524/755 and cs.stackexchange.com/q/9804/755. I encourage you to search to see what other material is available on this site before asking. $\endgroup$ – D.W. Aug 8 '16 at 5:02

Browse other questions tagged or ask your own question.