aboutsummaryrefslogtreecommitdiffhomepage
path: root/intf/extend.mli
diff options
context:
space:
mode:
Diffstat (limited to 'intf/extend.mli')
-rw-r--r--intf/extend.mli34
1 files changed, 34 insertions, 0 deletions
diff --git a/intf/extend.mli b/intf/extend.mli
index ad9706f3a..975f194b0 100644
--- a/intf/extend.mli
+++ b/intf/extend.mli
@@ -50,3 +50,37 @@ type constr_prod_entry_key =
type simple_constr_prod_entry_key =
(production_level,unit) constr_entry_key_gen
+
+(** {5 Type-safe grammar extension} *)
+
+type ('self, 'a) symbol =
+| Atoken : Tok.t -> ('self, string) symbol
+| Alist1 : ('self, 'a) symbol -> ('self, 'a list) symbol
+| Alist1sep : ('self, 'a) symbol * string -> ('self, 'a list) symbol
+| Alist0 : ('self, 'a) symbol -> ('self, 'a list) symbol
+| Alist0sep : ('self, 'a) symbol * string -> ('self, 'a list) symbol
+| Aopt : ('self, 'a) symbol -> ('self, 'a option) symbol
+| Amodifiers : ('self, 'a) symbol -> ('self, 'a list) symbol
+| Aself : ('self, 'self) symbol
+| Anext : ('self, 'self) symbol
+| Aentry : 'a Entry.t -> ('self, 'a) symbol
+| Aentryl : 'a Entry.t * int -> ('self, 'a) symbol
+
+type ('self, _, 'r) rule =
+| Stop : ('self, 'r, 'r) rule
+| Next : ('self, 'a, 'r) rule * ('self, 'b) symbol -> ('self, 'b -> 'a, 'r) rule
+
+type 'a production_rule =
+| Rule : ('a, 'act, Loc.t -> 'a) rule * 'act -> 'a production_rule
+
+type 'a single_extend_statment =
+ string option *
+ (** Level *)
+ gram_assoc option *
+ (** Associativity *)
+ 'a production_rule list
+ (** Symbol list with the interpretation function *)
+
+type 'a extend_statment =
+ gram_position option *
+ 'a single_extend_statment list