Skip to content
This repository
Newer
Older
100644 221 lines (190 sloc) 12.679 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 open SurfaceAst
19 open QmlLoc (* brings annot into scope *)
20
21 module type IDENT =
22 sig
23 type ident
24 val equal : ident -> ident -> bool
25 val val_ : string -> ident
26 val typ : string -> ident
27 val fresh : unit -> ident (* typevar only *)
28 val ns_fresh : label:QmlLoc.annot -> string -> ident (* for any (expression) identifiers *)
29 end
30
31 module type CONS =
32 sig
33 type ident
34 type ident' = ident
35
36 module I : IDENT with type ident = ident'
37
38 (** @inline doc *)
39 (* Types *)
40 module T :
41 sig
42 val name : ?label:annot -> ?tyl:ident ty list -> string -> ident ty
43 val row_t : ?label:annot -> ?row:'a rowvar -> 'a fields_t_node -> 'a row_t
44 val args : ?label:annot -> ident ty list -> ident row_t
45 val arrow : ?label:annot -> ident ty list -> ident ty -> ident arrow_t
46 val arrow_1 : ?label:annot -> ident ty -> ident ty -> ident arrow_t
47 val arrow_2 : ?label:annot -> ident ty -> ident ty -> ident ty -> ident arrow_t
48
49 val external_ : ?label:annot -> unit -> ident ty
50
51 val typedef_node : ?tyvs:ident typevar list -> type_def_visibility -> ident -> ident ty -> ident typedef_node
52 val typedef : ?label:annot -> ?tyvs:ident typevar list -> type_def_visibility -> ident -> ident ty -> ident typedef
53
54 val typevar : ident -> ident typevar
55 val var : ?label:annot -> ident -> ident ty
56 val fresh : ?label:annot -> unit -> ident ty
57
58 val coerce : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> ident ty -> (ident, 'a) expr
59 val coerce_name : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> string -> (ident, 'a) expr
60
61 val record : ?label:annot -> ?row:ident rowvar -> ident fields_t_node -> ident ty
62 val tuple : ?label:annot -> ?row:ident rowvar -> ident ty list -> ident ty
63
64 val void : ?label:annot -> unit -> ident ty
65 val string : ?label:annot -> unit -> ident ty
66 val int : ?label:annot -> unit -> ident ty
67 val float : ?label:annot -> unit -> ident ty
68 val char : ?label:annot -> unit -> ident ty
69 val bool : ?label:annot -> unit -> ident ty
70 end
71
72 (* Patterns *)
73 (** @inline doc *)
74 module P :
75 sig
76 val coerce : ?label:annot -> ident pat -> ident ty -> ident pat
77 val coerce_name : ?label:annot -> ident pat -> string -> ident pat
78
79 val any : ?label:annot -> unit -> ident pat
80 val ident : ?label:annot -> ident -> ident pat
81 val var : ?label:annot -> ident -> ident pat
82
83 val string : ?label:annot -> string -> ident pat
84
85 val record : ?label:annot -> ?row:bool -> ident pat_record_node -> ident pat
86 val record1 : ?label:annot -> string -> ident pat -> ident pat
87 val simple_record : ?label:annot -> string -> ident pat
88 val tuple : ?label:annot -> ident pat list -> ident pat
89 val tuple_2 : ?label:annot -> ident pat -> ident pat -> ident pat
90
91 val void : ?label:annot -> unit -> ident pat
92 val true_ : ?label:annot -> unit -> ident pat
93 val false_ : ?label:annot -> unit -> ident pat
94 val bool : ?label:annot -> bool -> ident pat
95 val cons : ?label:annot -> ident pat -> ident pat -> ident pat
96 val nil : ?label:annot -> unit -> ident pat
97 val hd_tl : ?label:annot -> ident pat -> ident pat -> ident pat
98 val list : ?label:annot -> ident pat list -> ident pat
99 val none : ?label:annot -> unit -> ident pat
100 val some : ?label:annot -> ident pat -> ident pat
101 end
102
103 (* Expressions *)
104 (** @inline doc *)
105 module E :
106 sig
107 val coerce : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> ident ty -> (ident, 'a) expr
108 val coerce_name : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> string -> (ident, 'a) expr
109
110 val record : ?label:annot -> (ident, 'a) record_node -> (ident, 'a) expr
111 val simple_record : ?label:annot -> string -> ('a, [< all_directives > `coerce ]) expr
112 val record1 : ?label:annot -> string -> (ident, 'a) expr -> (ident, 'a) expr
113 val tuple : ?label:annot -> (ident, 'a) expr list -> (ident, 'a) expr
114 val tuple_2 : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
115
116 val constant : ?label:annot -> const_expr_node -> (ident, _) expr
117 val string : ?label:annot -> string -> (ident, _) expr
118 val float : ?label:annot -> float -> (ident, _) expr
119 val big_int : ?label:annot -> Big_int.big_int -> (ident, _) expr
120 val int : ?label:annot -> int -> (ident, _) expr
121 val unicode_char : ?label:annot -> int -> (ident, _) expr
122 val char : ?label:annot -> char -> (ident, _) expr
123
124 val ident : ?label:annot -> ident -> (ident, _) expr
125 val var : ?label:annot -> ident -> (ident, _) expr
126
127 val void : ?label:annot -> unit -> ('a, [< all_directives > `coerce ]) expr
128 val true_ : ?label:annot -> unit -> (ident, [< all_directives > `coerce ]) expr
129 val false_ : ?label:annot -> unit -> (ident, [< all_directives > `coerce ]) expr
130 val bool : ?label:annot -> bool -> (ident, [< all_directives > `coerce ]) expr
131 val cons : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
132 val nil : ?label:annot -> unit -> (ident, [< all_directives > `coerce ]) expr
133 val list : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr list -> (ident, 'a) expr
134 val none : ?label:annot -> unit -> (ident, [< all_directives > `coerce ]) expr
135 val some : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> (ident, 'a) expr
136
137 val dot : ?label:annot -> (ident, 'a) expr -> string -> (ident, 'a) expr
138
139 val lambda : ?label:annot -> ident pat list -> (ident, 'a) expr -> (ident, 'a) expr
140 val lambda_var : ?label:annot -> ident -> (ident, 'a) expr -> (ident, 'a) expr
141 val lambda_ignore : ?label:annot -> (ident, 'a) expr -> (ident, 'a) expr
142 val lambda_void : ?label:annot -> (ident, 'a) expr -> (ident, 'a) expr
143 val applys : ?label:annot -> (ident, 'a) expr -> (ident, 'a) expr list -> (ident, 'a) expr
144 val apply : ?label:annot -> (ident, 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
145 val apply2 : ?label:annot -> (ident, 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
146 val apply_void : ?label:annot -> (ident, ([> `coerce ] as 'a)) expr -> (ident, 'a) expr
147 val eta_expand : ?label:annot -> int -> (ident, 'a) expr -> (ident, 'a) expr
148
149 val match_ : ?label:annot -> (ident, 'a) expr -> (ident pat * (ident, 'a) expr) list -> (ident, 'a) expr
150 val if_ : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
151 val if_then : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
152 val if_not : ?label:annot -> (ident, [< all_directives > `coerce ] as 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
153 val match_opt : ?label:annot -> ?ty:ident ty -> (ident, [< all_directives > `coerce ] as 'a) expr -> ident pat * (ident, 'a) expr ->
154 ident pat * (ident, 'a) expr -> (ident, 'a) expr
155 val match_option : ?label:annot -> ?ty:ident ty -> (ident, [< all_directives > `coerce ] as 'a) expr -> (ident, 'a) expr ->
156 (ident -> (ident, 'a) expr) -> (ident, 'a) expr
157
158 val letgen : ?label:annot -> rec_:bool -> (ident * (ident, 'a) expr) list -> (ident, 'a) expr -> (ident, 'a) expr
159 val letrec : ?label:annot -> (ident * (ident, 'a) expr) list -> (ident, 'a) expr -> (ident, 'a) expr
160 val letand : ?label:annot -> (ident * (ident, 'a) expr) list -> (ident, 'a) expr -> (ident, 'a) expr
161 val letin : ?label:annot -> ident -> (ident, 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
162 val letins : ?label:annot -> (ident * (ident, 'a) expr) list -> (ident, 'a) expr -> (ident, 'a) expr
163 val bypass : ?label:annot -> string -> (ident, 'a) expr
164 end
165
166 (* Directives *)
167 (** @inline doc *)
168 module D :
169 sig
170 (* directives types *)
171 (** @inline doc *)
172 module T :
173 sig
174 val static_source_content : ?label:annot -> unit -> ident arrow_t
175 val static_include_directory : ?label:annot -> unit -> ident arrow_t
176 val static_binary_content : ?label:annot -> unit -> ident arrow_t
177 val assert_message : ?label:annot -> unit -> ident arrow_t
178 val ensure_message : ?label:annot -> unit -> ident arrow_t
179 val deprecated : ?label:annot -> unit -> ident arrow_t
180 val warning : ?label:annot -> unit -> ident arrow_t
181 val assert_ : ?label:annot -> unit -> ident arrow_t
182 val client : ?label:annot -> unit -> ident arrow_t
183 val server : ?label:annot -> unit -> ident arrow_t
184 val ensure : ?label:annot -> unit -> ident arrow_t
185 val fail : ?label:annot -> unit -> ident arrow_t
186 val force : ?label:annot -> unit -> ident arrow_t
187 val private_ : ?label:annot -> unit -> ident arrow_t
188 val protected : ?label:annot -> unit -> ident arrow_t
189 val slicer : ?label:annot -> unit -> ident arrow_t
190 val translate : ?label:annot -> unit -> ident arrow_t
191 val unsafe_cast : ?label:annot -> unit -> ident arrow_t
192 val spawn : ?label:annot -> unit -> ident arrow_t
193 val lazy_ : ?label:annot -> unit -> ident arrow_t
194 val magic_to_string : ?label:annot -> unit -> ident arrow_t
195 val magic_to_xml : ?label:annot -> unit -> ident arrow_t
196 val side_annotation : ?label:annot -> unit -> ident arrow_t
197 val visibility_annotation : ?label:annot -> unit -> ident arrow_t
198 end
199 (* directive expressions *)
200 val open_ : ?label:annot -> (ident, [< all_directives > `open_ ] as 'a) expr -> (ident, 'a) expr -> (ident, 'a) expr
201 val doctype : string list -> ?label:annot -> ?access:SurfaceAst.access_directive -> (ident, [< all_directives > `doctype ] as 'a) expr -> (ident, 'a) expr
202 val side_annotation : ?label:annot -> [`server | `client | `both | `prefer_server | `prefer_client | `prefer_both | `both_implem ] ->
203 (ident, [< all_directives > `side_annotation] as 'a) expr -> (ident,'a) expr
204 val visibility_annotation : ?label:annot -> [`public of [`sync | `async | `funaction] | `private_] -> (ident, [< all_directives > `visibility_annotation] as 'a) expr -> (ident,'a) expr
205 val static_content : ?label:annot -> ?factory_helper:(ident, 'a) expr -> bool -> string -> (ident, [> `static_content of (string * bool) ] as 'a) expr
206 val static_resource: ?label:annot -> ?factory_helper:(ident, 'a) expr -> string -> (ident, [> `static_resource of string ] as 'a) expr
207 val server_entry_point : ?label:annot -> (ident, [> `server_entry_point ] as 'a) expr -> (ident, 'a) expr
208 end
209
210 (* code element *)
211 (** @inline doc *)
212 module C :
213 sig
214 val newval_pel : ?rec_:bool -> ?label:annot -> (ident pat * (ident, 'a) expr) list -> (ident, 'a) code_elt
215 val newval : ?label:annot -> ident -> (ident, 'a) expr -> (ident, 'a) code_elt
216 val newvalrec : ?label:annot -> ident -> (ident, 'a) expr -> (ident, 'a) code_elt
217 val newval_ignore : ?label:annot -> (ident, 'a) expr -> (ident, 'a) code_elt
218 val newtype : ?label:annot -> ident typedef -> (ident, _) code_elt
219 end
220
221 end
Something went wrong with that request. Please try again.