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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (show annotations)
Tue Jul 10 16:58:37 2007 UTC (5 years, 10 months ago) by abate
File size: 4259 byte(s)
[r2002-10-20 19:07:35 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-20 19:08:05+00:00
1 type label = int
2 type atom = int
3 type const = Integer of Big_int.big_int | Atom of atom | Char of Chars.Unichar.t
4
5 (** Algebra **)
6
7 type node
8 type descr
9
10 val make: unit -> node
11 val define: node -> descr -> unit
12
13 val cons: descr -> node
14 val internalize: node -> node
15
16 val id: node -> int
17 val descr: node -> descr
18
19 val equal_descr: descr -> descr -> bool
20 val hash_descr: descr -> int
21
22
23 module DescrHash: Hashtbl.S with type key = descr
24
25 (** Boolean connectives **)
26
27 val cup : descr -> descr -> descr
28 val cap : descr -> descr -> descr
29 val diff : descr -> descr -> descr
30 val neg : descr -> descr
31 val empty : descr
32 val any : descr
33
34 (** Constructors **)
35
36 val interval : Big_int.big_int -> Big_int.big_int -> descr
37 val atom : atom Atoms.t -> descr
38 val times : node -> node -> descr
39 val arrow : node -> node -> descr
40 val record : label -> bool -> node -> descr
41 val char : Chars.t -> descr
42 val constant : const -> descr
43
44 (** Positive systems and least solutions **)
45
46 module Positive :
47 sig
48 type v
49 val forward: unit -> v
50 val define: v -> v -> unit
51 val ty: descr -> v
52 val cup: v list -> v
53 val times: v -> v -> v
54
55 val solve: v -> node
56 end
57
58 (** Labels and atom names **)
59
60 val mk_atom : string -> atom
61 val atom_name : atom -> string
62
63 val label : string -> label
64 val label_name : label -> string
65
66 (** Normalization **)
67
68 module Product : sig
69 val any : descr
70 val other : descr -> descr
71 val is_product : descr -> bool
72
73 (* List of non-empty rectangles *)
74 type t = (descr * descr) list
75 val is_empty: t -> bool
76 val get: descr -> t
77 val pi1: t -> descr
78 val pi2: t -> descr
79
80 (* Intersection with (pi1,Any) *)
81 val restrict_1: t -> descr -> t
82
83 (* List of non-empty rectangles whose first projection
84 are pair-wise disjunct *)
85 type normal = t
86 val normal: descr -> normal
87
88 val need_second: t -> bool
89 (* Is there more than a single rectangle ? *)
90 end
91
92 module Record : sig
93 val any : descr
94
95 (* List of maps label -> (optional, content) *)
96 type t = (label, (bool * descr)) SortedMap.t list
97 val get: descr -> t
98 val is_empty: t -> bool
99 val restrict_label_present: t -> label -> t
100 val restrict_field: t -> label -> descr -> t
101 val restrict_label_absent: t -> label -> t
102 val project_field: t -> label -> descr
103
104 type normal =
105 [ `Success
106 | `Fail
107 | `Label of label * (descr * normal) list * normal ]
108 val normal: descr -> normal
109
110 val project : descr -> label -> descr
111 (* Raise Not_found if label is not necessarily present *)
112 end
113
114 module Arrow : sig
115 val any : descr
116
117 val check_strenghten: descr -> descr -> descr
118 (* [check_strenghten t s]
119 Assume that [t] is an intersection of arrow types
120 representing the interface of an abstraction;
121 check that this abstraction has type [s] (otherwise raise Not_found)
122 and returns a refined type for this abstraction.
123 *)
124
125 type t
126 val is_empty: t -> bool
127 val get: descr -> t
128 (* Always succeed; no check <= Arrow.any *)
129
130 val domain: t -> descr
131 val apply: t -> descr -> descr
132 (* Always succeed; no check on the domain *)
133
134 val need_arg : t -> bool
135 (* True if the type of the argument is needed to obtain
136 the type of the result (must use [apply]; otherwise,
137 [apply_noarg] is enough *)
138 val apply_noarg : t -> descr
139 end
140
141
142 module Int : sig
143 val any : descr
144
145 val is_int : descr -> bool
146 val get: descr -> Intervals.t
147 val put: Intervals.t -> descr
148 end
149
150 module Atom : sig
151 val has_atom : descr -> atom -> bool
152 end
153
154 val normalize : node -> node
155
156 (** Subtyping and sample values **)
157
158 val is_empty : descr -> bool
159 val non_empty: descr -> bool
160 val subtype : descr -> descr -> bool
161
162 module Sample :
163 sig
164 type t =
165 | Int of Big_int.big_int
166 | Atom of atom
167 | Char of Chars.Unichar.t
168 | Pair of t * t
169 | Record of (label * t) list
170 | Fun of (node * node) list
171
172 val get : descr -> t
173 (**
174 Extract a sample value from a non empty type;
175 raise Not_found for an empty type
176 **)
177 end
178
179 module Print :
180 sig
181 val register_global : string -> descr -> unit
182
183 val print : Format.formatter -> node -> unit
184 val print_descr: Format.formatter -> descr -> unit
185 val print_sample : Format.formatter -> Sample.t -> unit
186 end
187
188 val check: descr -> unit

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