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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 367 - (show annotations)
Tue Jul 10 17:28:43 2007 UTC (5 years, 10 months ago) by abate
File size: 4919 byte(s)
[r2003-05-18 14:42:51 by cvscast] Clean-up

Original author: cvscast
Date: 2003-05-18 14:44:17+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 val compare_const: const -> const -> int
8 val hash_const: const -> int
9 val equal_const: const -> const -> bool
10
11 (** Algebra **)
12
13 type node
14 type descr
15
16 val make: unit -> node
17 val define: node -> descr -> unit
18
19 val cons: descr -> node
20 val internalize: node -> node
21
22 val id: node -> int
23 val descr: node -> descr
24
25 val equal_descr: descr -> descr -> bool
26 val hash_descr: descr -> int
27 val compare_descr: descr -> descr -> int
28
29 module DescrHash: Hashtbl.S with type key = descr
30 module DescrSList: SortedList.S with type 'a elem = descr
31 module DescrMap: Map.S with type key = descr
32
33 (** Boolean connectives **)
34
35 val cup : descr -> descr -> descr
36 val cap : descr -> descr -> descr
37 val diff : descr -> descr -> descr
38 val neg : descr -> descr
39 val empty : descr
40 val any : descr
41
42 val any_node : node
43
44 (** Constructors **)
45
46 type pair_kind = [ `Normal | `XML ]
47
48 val interval : Intervals.t -> descr
49 val atom : Atoms.t -> descr
50 val times : node -> node -> descr
51 val xml : node -> node -> descr
52 val arrow : node -> node -> descr
53 val record : label -> node -> descr
54 val record' : bool * node label_map -> descr
55 val char : Chars.t -> descr
56 val constant : const -> descr
57
58 (** Positive systems and least solutions **)
59
60 module Positive :
61 sig
62 type v
63 val forward: unit -> v
64 val define: v -> v -> unit
65 val ty: descr -> v
66 val cup: v list -> v
67 val times: v -> v -> v
68 val xml: v -> v -> v
69
70 val solve: v -> node
71 end
72
73 (** Normalization **)
74
75 module Product : sig
76 val any : descr
77 val any_xml : descr
78 val other : ?kind:pair_kind -> descr -> descr
79 val is_product : ?kind:pair_kind -> descr -> bool
80
81 (* List of non-empty rectangles *)
82 type t = (descr * descr) list
83 val is_empty: t -> bool
84 val get: ?kind:pair_kind -> descr -> t
85 val pi1: t -> descr
86 val pi2: t -> descr
87 val pi2_restricted: descr -> t -> descr
88
89 (* Intersection with (pi1,Any) *)
90 val restrict_1: t -> descr -> t
91
92 (* List of non-empty rectangles whose first projection
93 are pair-wise disjunct *)
94 type normal = t
95 val normal: ?kind:pair_kind -> descr -> normal
96
97 val constraint_on_2: normal -> descr -> descr
98 (* constraint_on_2 n t1: maximal t2 such that (t1,t2) <= n *)
99 (* Assumption: t1 <= pi1(n) *)
100
101 val need_second: t -> bool
102 (* Is there more than a single rectangle ? *)
103 end
104
105 module Record : sig
106 val any : descr
107 val or_absent: descr -> descr
108 val any_or_absent: descr
109
110 val has_absent: descr -> bool
111 val has_record: descr -> bool
112
113 val split : descr -> label -> Product.t
114 val split_normal : descr -> label -> Product.normal
115
116 val project : descr -> label -> descr
117 (* Raise Not_found if label is not necessarily present *)
118
119 val condition : descr -> label -> descr -> descr
120 (* condition t1 l t2 : What must follow if field l hash type t2 *)
121 val project_opt : descr -> label -> descr
122 val has_empty_record: descr -> bool
123
124
125 val first_label: descr -> label
126
127 val empty_cases: descr -> bool * bool
128
129 val merge: descr -> descr -> descr
130 val remove_field: descr -> label -> descr
131
132 val get: descr -> (descr label_map * bool * bool) list
133 end
134
135 module Arrow : sig
136 val any : descr
137
138 val check_strenghten: descr -> descr -> descr
139 (* [check_strenghten t s]
140 Assume that [t] is an intersection of arrow types
141 representing the interface of an abstraction;
142 check that this abstraction has type [s] (otherwise raise Not_found)
143 and returns a refined type for this abstraction.
144 *)
145
146 val check_iface: (descr * descr) list -> descr -> bool
147
148 type t
149 val is_empty: t -> bool
150 val get: descr -> t
151 (* Always succeed; no check <= Arrow.any *)
152
153 val domain: t -> descr
154 val apply: t -> descr -> descr
155 (* Always succeed; no check on the domain *)
156
157 val need_arg : t -> bool
158 (* True if the type of the argument is needed to obtain
159 the type of the result (must use [apply]; otherwise,
160 [apply_noarg] is enough *)
161 val apply_noarg : t -> descr
162 end
163
164
165 module Int : sig
166 val has_int : descr -> Intervals.v -> bool
167 val get: descr -> Intervals.t
168 val any : descr
169 end
170
171 module Atom : sig
172 val has_atom : descr -> Atoms.v -> bool
173 val get: descr -> Atoms.t
174 end
175
176 module Char : sig
177 val has_char : descr -> Chars.v -> bool
178 val get: descr -> Chars.t
179 val any : descr
180 end
181
182 val normalize : descr -> descr
183
184 (** Subtyping and sample values **)
185
186 val is_empty : descr -> bool
187 val non_empty: descr -> bool
188 val subtype : descr -> descr -> bool
189
190 module Sample :
191 sig
192 type t
193
194 val get : descr -> t
195 (**
196 Extract a sample value from a non empty type;
197 raise Not_found for an empty type
198 **)
199
200 val print : Format.formatter -> t -> unit
201 end
202
203 module Print :
204 sig
205 val register_global : string -> descr -> unit
206 val print_const : Format.formatter -> const -> unit
207 val print: Format.formatter -> descr -> unit
208 end
209

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