EXTEND

From Gallium

Jump to: navigation, search

This page just holds the EXTEND syntax used for Extensible Parsers of Camlp4.

 grammar-extension ::=
   | EXTEND <gram-name> (GLOBAL: <entry-name>*;)? <entry>* END;
 
 entry ::=
   | <entry-name>: <position>? [ <level> | ... | <level> ];
 
 position ::=
   | FIRST
   | LAST
   | BEFORE "<level-name>"
   | AFTER  "<level-name>"
   | LEVEL  "<level-name>"
 
 level ::=
   | "<level-name>"? <associativity>? <level-rules>
 
 associativity ::=
   | LEFTA       (* The default one *)
   | RIGHTA
   | NONA
 
 level-rules ::=
   | [ <rule> | ... | <rule> ]
 
 rule ::=
   | <symbol> ; ... ; <symbol> -> <semantic-action>
 
 semantic-action ::=
   | <caml-expression>
 
 symbol ::=
   | <simple-symbol>
   | `<caml-pattern>    (* Match a token with an OCaml pattern, returns the token *)
   | <caml-identifier> = <simple-symbol>
   | ( <caml-ident> , ... , <caml-ident> ) = <simple-symbol>
 
 simple-symbol ::=
   | SELF
   | NEXT
   | <entry-name> (LEVEL "<level-name>")?
   | <level-rules>
   | "<keyword>"
   | OPT <simple-symbol>
   | LIST{0,1} <simple-symbol> (SEP <simple-symbol>)?
   | <token-constructor>
Personal tools
Espace privé