0

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?

Evil
  • 9,455
  • 11
  • 31
  • 52
Kevin
  • 1
  • 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 08 '16 at 03:51
  • 1
    Welcome to CS.SE! See http://cs.stackexchange.com/q/18524/755 and http://cs.stackexchange.com/q/9804/755. I encourage you to search to see what other material is available on this site before asking. – D.W. Aug 08 '16 at 05:02

0 Answers0