-
Notifications
You must be signed in to change notification settings - Fork 2
Grammar
Mehmet Dolgun edited this page Mar 5, 2018
·
5 revisions
A grammar is of the form:
Rule ::= Head "->" Prod [ ":" Prod ] [ Feat ] [ "#" Comment ]
Prod ::= ( Terminal | NonTerminal [ "-" Suffix ] [ FParam ] )* [ "{" Cost "}" ]
Feat ::= "[" [ Name "=" Value ( "," Name "=" Value )* ] "]"
FParam ::= "(" [ Name [ "=" Value ] ( "," Name [ "=" Value ] )* ")"
where lexical symbols are:
- Terminal : Words starting with lowercase or -, containing alphabetics and - and ' or any characters between double quotes
- NonTerminal : Words starting with uppercase, containing alphanumerics and _ optionally ending with '
- Suffix, Name, Value : Words containing alphanumerics
- Cost : Integer
White space is ignored except between a NonTerminal and its parameters (e.g S -> A()
is ok, but S-> A ()
is not ok).
Start symbol is S, your grammar should derive from this.
Internally S' is used as pre-start symbol and should not be used.
Whitespace-only and/or comment-only lines are ignored