@@ -9,13 +9,52 @@ module type EXPR = sig
99 val is_functor : t -> bool
1010end
1111
12- module type LANGUAGE = sig
13- type 'declaration directive [@@deriving show]
14- type extra_module_info [@@deriving show]
15- end
16-
1712type head = { name : string ; arity : int } [@@ deriving show , ord ]
1813
14+ module ClauseF (Expr : EXPR ) = struct
15+ type multi_declaration = head * decl * decl Location .with_location list
16+ [@@ deriving show ]
17+
18+ and ('directives, 'mods) signature_ref =
19+ | Named of string Location. with_location
20+ | Inlined of {
21+ declarations : multi_declaration Location .with_location list ;
22+ directives : ('directives , 'mods ) directive Location .with_location list ;
23+ }
24+ [@@ deriving show]
25+
26+ and ('directives, 'mods) directive =
27+ | Module of {
28+ name : string Location .with_location ;
29+ signature : ('directives , 'mods ) signature_ref option ;
30+ declarations : multi_declaration Location .with_location list ;
31+ directives : ('directives , 'mods ) directive Location .with_location list ;
32+ target_specific : 'mods ;
33+ }
34+ | Signature of {
35+ name : string Location .with_location ;
36+ declarations : multi_declaration Location .with_location list ;
37+ directives : ('directives , 'mods ) directive Location .with_location list ;
38+ }
39+ | TargetSpecific of 'directives
40+ [@@ deriving show]
41+
42+ and ('directives, 'mods) base =
43+ | MultiDeclaration of multi_declaration
44+ | Query of { name : string ; arity : int ; args : string list }
45+ | Directive of ('directives, 'mods) directive
46+ [@@ deriving show]
47+
48+ and decl = {
49+ body : Expr .func Location .with_location list ;
50+ original_arg_list : Expr .t list ;
51+ }
52+ [@@ deriving show]
53+
54+ and ('directives, 'mods) t = ('directives, 'mods) base Location. with_location
55+ [@@ deriving show]
56+ end
57+
1958module Expr = struct
2059 type func_label =
2160 string Location .with_location list * string Location .with_location
@@ -132,94 +171,6 @@ module Expr = struct
132171 | _ -> false
133172end
134173
135- type multi_declaration = head * decl * decl Location .with_location list
136- [@@ deriving show ]
137-
138- and ('language_specific, 'target_specific) signature_ref =
139- | Named of string Location. with_location
140- | Inlined of {
141- declarations : multi_declaration Location .with_location list ;
142- directives :
143- ('language_specific , 'target_specific ) directive Location .with_location
144- list ;
145- }
146-
147- and ('language_specific, 'target_specific) directive =
148- | Module of {
149- name : string Location .with_location ;
150- signature : ('language_specific , 'target_specific ) signature_ref option ;
151- declarations : multi_declaration Location .with_location list ;
152- directives :
153- ('language_specific , 'target_specific ) directive Location .with_location
154- list ;
155- language_specific : 'language_specific ;
156- }
157- | Signature of {
158- name : string Location .with_location ;
159- declarations : multi_declaration Location .with_location list ;
160- directives :
161- ('language_specific , 'target_specific ) directive Location .with_location
162- list ;
163- }
164- | TargetSpecific of 'target_specific
165-
166- and ('language_specific, 'target_specific) base =
167- | MultiDeclaration of multi_declaration
168- | Query of { name : string ; arity : int ; args : string list }
169- | Directive of ('language_specific, 'target_specific) directive
170- [@@ deriving show]
171-
172- and decl = {
173- body : Expr .func Location .with_location list ;
174- original_arg_list : Expr .t list ;
175- }
176- [@@ deriving show]
177-
178- and ('language_specific, 'target_specific) t =
179- ('language_specific, 'target_specific) base Location. with_location
180- [@@ deriving show]
181-
182- module type CLAUSE = sig
183- module Target : LANGUAGE
184-
185- type nonrec multi_declaration = multi_declaration
186-
187- type nonrec t =
188- (multi_declaration Target .directive , Target .extra_module_info ) t
189-
190- type nonrec signature_ref =
191- (multi_declaration Target .directive , Target .extra_module_info ) signature_ref
192-
193- type nonrec directive =
194- (multi_declaration Target .directive , Target .extra_module_info ) directive
195-
196- type nonrec base =
197- (multi_declaration Target .directive , Target .extra_module_info ) base
198-
199- type nonrec decl = decl
200- end
201-
202- module ClauseF (Expr : EXPR ) (Target : LANGUAGE ) :
203- CLAUSE with module Target = Target = struct
204- module Target = Target
205-
206- type nonrec multi_declaration = multi_declaration
207-
208- type nonrec t =
209- (multi_declaration Target .directive , Target .extra_module_info ) t
210-
211- type nonrec signature_ref =
212- (multi_declaration Target .directive , Target .extra_module_info ) signature_ref
213-
214- type nonrec directive =
215- (multi_declaration Target .directive , Target .extra_module_info ) directive
216-
217- type nonrec base =
218- (multi_declaration Target .directive , Target .extra_module_info ) base
219-
220- type nonrec decl = decl
221- end
222-
223174module ParserClauseF (Expr : EXPR ) = struct
224175 type base =
225176 | Declaration of decl
0 commit comments