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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 159 - (show annotations)
Tue Jul 10 17:11:29 2007 UTC (5 years, 10 months ago) by abate
File size: 5492 byte(s)
[r2002-11-26 09:25:47 by cvscast] Empty log message

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

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