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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 271 - (show annotations)
Tue Jul 10 17:21:17 2007 UTC (5 years, 10 months ago) by abate
File size: 4930 byte(s)
[r2003-03-22 21:56:53 by cvscast] Empty log message

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

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