aboutsummaryrefslogtreecommitdiff
path: root/intf
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2015-10-26 11:50:11 +0100
committerPierre-Marie Pédrot2015-10-27 00:03:38 +0100
commitfb50a8aaf8826349ac8c3a90a6d9b354b9cf34ca (patch)
tree87e21a31c37a5314d38cfcd485a2b5fc4b23533b /intf
parentaff038fbbe5ade8d58a895b3d2f6e32267c5184c (diff)
Type-safe grammar extensions.
Diffstat (limited to 'intf')
-rw-r--r--intf/extend.mli34
1 files changed, 34 insertions, 0 deletions
diff --git a/intf/extend.mli b/intf/extend.mli
index ad9706f3a5..aa0db52d7f 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, Tok.t) 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