->
and a list of right hand sides seperated
by the |
character, and terminated with the ;
character.
Each right
hand side is specified by zero or more terminals or non-terminals.
Terminals and non-terminals are represented by names starting with
a letter or an underscore and containing letters, underscores and
digits.
Each right hand side may be given an optional precedence, which will be described shortly. Each right hand side may also be associated with a block of action code. Action code is specified with a colon character followed by either a line of code, or a newline and an indented block of code.
An example of a production is:
E -> TOK_ID : return symtab[kids[0]] | E TOK_ADD E : return kids[0] + kids[2] ;
There may be many production rules in the spec file. The left hand side of the first production is taken to be the start symbol of the grammar.
See the PyGgy Home Page.