/[svn]/types/types.mli
ViewVC logotype

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 233 - (show annotations)
Tue Jul 10 17:17:31 2007 UTC (5 years, 10 months ago) by abate
File size: 5867 byte(s)
[r2003-03-10 22:35:20 by cvscast] De nouveau rapides, les records

Original author: cvscast
Date: 2003-03-10 22:35:21+00:00
1 open Ident
2
3 type const = | Integer of Intervals.v
4 | Atom of Atoms.v
5 | Char of Chars.v
6
7 (** Algebra **)
8
9 type node
10 type descr
11
12 val make: unit -> node
13 val define: node -> descr -> unit
14
15 val cons: descr -> node
16 val internalize: node -> node
17
18 val id: node -> int
19 val descr: node -> descr
20
21 val equal_descr: descr -> descr -> bool
22 val hash_descr: descr -> int
23
24 module DescrHash: Hashtbl.S with type key = descr
25 module DescrMap: Map.S with type key = descr
26
27 (* Note: it seems that even for non-functional data, DescrMap
28 is more efficient than DescrHash ... *)
29
30 (** Boolean connectives **)
31
32 val cup : descr -> descr -> descr
33 val cap : descr -> descr -> descr
34 val diff : descr -> descr -> descr
35 val neg : descr -> descr
36 val empty : descr
37 val any : descr
38
39 val any_node : node
40
41 (** Constructors **)
42
43 type pair_kind = [ `Normal | `XML ]
44
45 val interval : Intervals.t -> descr
46 val atom : Atoms.t -> descr
47 val times : node -> node -> descr
48 val xml : node -> node -> descr
49 val arrow : node -> node -> descr
50 val record : label -> node -> descr
51 val record' : bool * node label_map -> descr
52 val char : Chars.t -> descr
53 val constant : const -> descr
54
55 (** Positive systems and least solutions **)
56
57 module Positive :
58 sig
59 type v
60 val forward: unit -> v
61 val define: v -> v -> unit
62 val ty: descr -> v
63 val cup: v list -> v
64 val times: v -> v -> v
65
66 val solve: v -> node
67 end
68
69 (** Normalization **)
70
71 module Product : sig
72 val any : descr
73 val any_xml : descr
74 val other : ?kind:pair_kind -> descr -> descr
75 val is_product : ?kind:pair_kind -> descr -> bool
76
77 (* List of non-empty rectangles *)
78 type t = (descr * descr) list
79 val is_empty: t -> bool
80 val get: ?kind:pair_kind -> descr -> t
81 val pi1: t -> descr
82 val pi2: t -> descr
83 val pi2_restricted: descr -> t -> descr
84
85 (* Intersection with (pi1,Any) *)
86 val restrict_1: t -> descr -> t
87
88 (* List of non-empty rectangles whose first projection
89 are pair-wise disjunct *)
90 type normal = t
91 val normal: ?kind:pair_kind -> descr -> normal
92
93 val need_second: t -> bool
94 (* Is there more than a single rectangle ? *)
95 end
96
97 module Record : sig
98 val any : descr
99 val or_absent: descr -> descr
100 val any_or_absent: descr
101
102 val has_absent: descr -> bool
103 val has_record: descr -> bool
104
105 val split : descr -> label -> Product.t
106 val split_normal : descr -> label -> Product.normal
107
108 val project : descr -> label -> descr
109 (* Raise Not_found if label is not necessarily present *)
110
111 val first_label: descr -> label
112
113 val empty_cases: descr -> bool * bool
114
115
116
117 (*
118 val restrict_field : t -> label -> descr -> t
119 val restrict_label_absent: t -> label -> t
120 val restrict_label_present: t -> label -> t
121 val label_present: t -> label -> (descr * t) list
122 val somefield_possible: t -> bool
123 val nofield_possible: t -> bool
124 val any : descr
125 val project_field: t -> label -> descr
126 val project : descr -> label -> descr
127
128 (*
129 (* List of maps label -> (optional, content) *)
130 type t (* = (label, (bool * descr)) SortedMap.t list *)
131 val get: descr -> t
132 val descr: t -> descr
133 val is_empty: t -> bool
134 val restrict_label_present: t -> label -> t
135 val restrict_field: t -> label -> descr -> t
136 val restrict_label_absent: t -> label -> t
137 val project_field: t -> label -> descr
138 *)
139
140 type normal =
141 [ `Success (* { } *)
142 | `Fail (* Empty *)
143 | `NoField (* {| |} *)
144 | `SomeField (* { } \ {| |} *)
145 | `Label of label * (descr * normal) list * normal ]
146
147 val normal: descr -> normal
148
149 val normal': t -> label -> (descr * t) list * t
150 val first_label: t -> [ `Success|`Fail|`NoField|`SomeField|`Label of label ]
151
152 val change_field: t -> label -> node -> t
153
154 (*
155 val project : descr -> label -> descr
156 (* Raise Not_found if label is not necessarily present *)
157 *)
158 *)
159 end
160
161 module Arrow : sig
162 val any : descr
163
164 val check_strenghten: descr -> descr -> descr
165 (* [check_strenghten t s]
166 Assume that [t] is an intersection of arrow types
167 representing the interface of an abstraction;
168 check that this abstraction has type [s] (otherwise raise Not_found)
169 and returns a refined type for this abstraction.
170 *)
171
172 val check_iface: (descr * descr) list -> descr -> bool
173
174 type t
175 val is_empty: t -> bool
176 val get: descr -> t
177 (* Always succeed; no check <= Arrow.any *)
178
179 val domain: t -> descr
180 val apply: t -> descr -> descr
181 (* Always succeed; no check on the domain *)
182
183 val need_arg : t -> bool
184 (* True if the type of the argument is needed to obtain
185 the type of the result (must use [apply]; otherwise,
186 [apply_noarg] is enough *)
187 val apply_noarg : t -> descr
188 end
189
190
191 module Int : sig
192 val has_int : descr -> Intervals.v -> bool
193
194 val any : descr
195
196 val is_int : descr -> bool
197 val get: descr -> Intervals.t
198 val put: Intervals.t -> descr
199 end
200
201 module Atom : sig
202 val has_atom : descr -> Atoms.v -> bool
203 end
204
205 module Char : sig
206 val has_char : descr -> Chars.v -> bool
207 val any : descr
208 end
209
210 val normalize : descr -> descr
211
212 (** Subtyping and sample values **)
213
214 val is_empty : descr -> bool
215 val non_empty: descr -> bool
216 val subtype : descr -> descr -> bool
217
218 module Sample :
219 sig
220 type t =
221 | Int of Intervals.v
222 | Atom of Atoms.v
223 | Char of Chars.v
224 | Pair of (t * t)
225 | Xml of (t * t)
226 | Record of (label * t) list
227 | Fun of (node * node) list
228 | Other
229
230 val get : descr -> t
231 (**
232 Extract a sample value from a non empty type;
233 raise Not_found for an empty type
234 **)
235
236 val print : Format.formatter -> t -> unit
237 end
238
239 module Print :
240 sig
241 val register_global : string -> descr -> unit
242 val print_const : Format.formatter -> const -> unit
243 val print : Format.formatter -> node -> unit
244 val print_descr: Format.formatter -> descr -> unit
245 end
246
247 val check: descr -> unit
248 val print_stat: Format.formatter -> unit

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5