An example left-recursive production is
<a> -> <a> b $It is left-recursive because the expansion of <a> leads to another expansion of <a> etc.
There are three predefined nonterminals: <id> represents an identifier, <num> represents a number, and <str> represents a string. finally, <empty> can be used to represent empty input.
A special construct error " string " allows error messages to be generated when parsing fails. For example, when used as the last alternative in a production, an error message is generated when none of the alternatives match with a given input string. However, the error construct should be used sparingly, because it can terminate the parsing even when the string is legal. Here is an example:
<start> -> <a> | <b> $ <a> -> a | error "`a' expected" $ <b> -> b | error "`b' expected" $When the input is b the parser will give an error message because an a was not found.