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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 186 - (show annotations)
Tue Jul 10 17:13:28 2007 UTC (5 years, 10 months ago) by abate
File size: 5619 byte(s)
[r2002-12-13 17:40:44 by cvscast] Empty log message

Original author: cvscast
Date: 2002-12-13 17:40:45+00:00
1 module LabelPool : Pool.T with type value = string
2 module AtomPool : Pool.T with type value = string
3 type label = LabelPool.t
4 type atom = AtomPool.t
5 type const = Integer of Big_int.big_int | Atom of atom | Char of Chars.Unichar.t
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 : 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 -> bool -> node -> descr
51 val record' : bool * (label, (bool * node)) SortedMap.t -> 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
84 (* Intersection with (pi1,Any) *)
85 val restrict_1: t -> descr -> t
86
87 (* List of non-empty rectangles whose first projection
88 are pair-wise disjunct *)
89 type normal = t
90 val normal: ?kind:pair_kind -> descr -> normal
91
92 val need_second: t -> bool
93 (* Is there more than a single rectangle ? *)
94 end
95
96 module Record : sig
97 type t
98 val get : descr -> t
99 val descr: t -> descr
100 val is_empty: t -> bool
101 val restrict_field : t -> label -> descr -> t
102 val restrict_label_absent: t -> label -> t
103 val restrict_label_present: t -> label -> t
104 val label_present: t -> label -> (descr * t) list
105 val somefield_possible: t -> bool
106 val nofield_possible: t -> bool
107 val any : descr
108 val project_field: t -> label -> descr
109 val project : descr -> label -> descr
110
111 (*
112 (* List of maps label -> (optional, content) *)
113 type t (* = (label, (bool * descr)) SortedMap.t list *)
114 val get: descr -> t
115 val descr: t -> descr
116 val is_empty: t -> bool
117 val restrict_label_present: t -> label -> t
118 val restrict_field: t -> label -> descr -> t
119 val restrict_label_absent: t -> label -> t
120 val project_field: t -> label -> descr
121 *)
122
123 type normal =
124 [ `Success (* { } *)
125 | `Fail (* Empty *)
126 | `NoField (* {| |} *)
127 | `SomeField (* { } \ {| |} *)
128 | `Label of label * (descr * normal) list * normal ]
129
130 val normal: descr -> normal
131
132 val normal': t -> label -> (descr * t) list * t
133 val first_label: t -> [ `Success|`Fail|`NoField|`SomeField|`Label of label ]
134
135 (*
136 val project : descr -> label -> descr
137 (* Raise Not_found if label is not necessarily present *)
138 *)
139 end
140
141 module Arrow : sig
142 val any : descr
143
144 val check_strenghten: descr -> descr -> descr
145 (* [check_strenghten t s]
146 Assume that [t] is an intersection of arrow types
147 representing the interface of an abstraction;
148 check that this abstraction has type [s] (otherwise raise Not_found)
149 and returns a refined type for this abstraction.
150 *)
151
152 val check_iface: (descr * descr) list -> descr -> bool
153
154 type t
155 val is_empty: t -> bool
156 val get: descr -> t
157 (* Always succeed; no check <= Arrow.any *)
158
159 val domain: t -> descr
160 val apply: t -> descr -> descr
161 (* Always succeed; no check on the domain *)
162
163 val need_arg : t -> bool
164 (* True if the type of the argument is needed to obtain
165 the type of the result (must use [apply]; otherwise,
166 [apply_noarg] is enough *)
167 val apply_noarg : t -> descr
168 end
169
170
171 module Int : sig
172 val has_int : descr -> Big_int.big_int -> bool
173
174 val any : descr
175
176 val is_int : descr -> bool
177 val get: descr -> Intervals.t
178 val put: Intervals.t -> descr
179 end
180
181 module Atom : sig
182 val has_atom : descr -> atom -> bool
183 end
184
185 module Char : sig
186 val has_char : descr -> Chars.Unichar.t -> bool
187 val any : descr
188 end
189
190 val normalize : descr -> descr
191
192 (** Subtyping and sample values **)
193
194 val is_empty : descr -> bool
195 val non_empty: descr -> bool
196 val subtype : descr -> descr -> bool
197
198 module Sample :
199 sig
200 type t =
201 | Int of Big_int.big_int
202 | Atom of atom
203 | Char of Chars.Unichar.t
204 | Pair of (t * t)
205 | Xml of (t * t)
206 | Record of (label * t) list
207 | Fun of (node * node) list
208 | Other
209
210 val get : descr -> t
211 (**
212 Extract a sample value from a non empty type;
213 raise Not_found for an empty type
214 **)
215
216 val print : Format.formatter -> t -> unit
217 end
218
219 module Print :
220 sig
221 val register_global : string -> descr -> unit
222 val print_const : Format.formatter -> const -> unit
223 val print : Format.formatter -> node -> unit
224 val print_descr: Format.formatter -> descr -> unit
225 end
226
227 val check: descr -> unit
228 val print_stat: Format.formatter -> unit

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