I am going through the following document trying to understand a simple grammar for a basic subtraction example (page 4).
The example states that
Simple arithmetic expressions of arbitrary length built from the subtraction operator '-' and the numerals 0 and 1 can be described by the following grammar:
E = T "-" E | T T = "0" | "1"
I understand T is the terminal symbols, but I am having a hard time understanding E. What confuses me even more is when it is stated:
Choosing the other alternative for E we might get the derivation...
E ==> "0" "-" E
How and why is an alternative to E include E? Likewise, I am having a hard time understanding how ET derives "0" or how EET derives 1.
Could someone better explain this to me? I would greatly appreciate it to move forward in the document. Maybe with a few examples would be extremely helpful.
ET derives "0" or how EET derives 1
, Where did you see that? It is not in the document you reference. By the way, this document is more parser engineering with specific techniques, than syntax and parsing science. $\endgroup$ – babou Sep 24 '14 at 10:30