I am learning about context-free grammars and as a toy example I wanted to design one that describes binary digits ending with 0.
My attempt : S -> 1S | 0S | e0 - where e is the empty string. Is this correct?
I am learning about context-free grammars and as a toy example I wanted to design one that describes binary digits ending with 0.
My attempt : S -> 1S | 0S | e0 - where e is the empty string. Is this correct?
Yes you're attempt seems fine. Try also to write it down formally, so that it is a direct application of the definition.
I would just omit the empty string, since $e0=0$. The way you write it just makes it harder to read and understand.