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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 160 - (hide annotations)
Tue Jul 10 17:11:34 2007 UTC (5 years, 10 months ago) by abate
File size: 5488 byte(s)
[r2002-11-26 14:13:32 by cvscast] Empty log message

Original author: cvscast
Date: 2002-11-26 14:13:33+00:00
1 abate 78 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 abate 15 type const = Integer of Big_int.big_int | Atom of atom | Char of Chars.Unichar.t
6 abate 1
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 abate 16 val equal_descr: descr -> descr -> bool
22     val hash_descr: descr -> int
23 abate 1
24 abate 16
25 abate 17 module DescrHash: Hashtbl.S with type key = descr
26 abate 68 module DescrMap: Map.S with type key = descr
27 abate 17
28 abate 68 (* Note: it seems that even for non-functional data, DescrMap
29     is more efficient than DescrHash ... *)
30    
31 abate 1 (** 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 abate 110 type pair_kind = [ `Normal | `XML ]
43    
44 abate 52 val interval : Intervals.t -> descr
45 abate 18 val atom : atom Atoms.t -> descr
46 abate 1 val times : node -> node -> descr
47 abate 110 val xml : node -> node -> descr
48 abate 1 val arrow : node -> node -> descr
49     val record : label -> bool -> node -> descr
50 abate 159 val record' : bool * (label, (bool * node)) SortedMap.t -> descr
51 abate 18 val char : Chars.t -> descr
52 abate 1 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 abate 110 val any_xml : descr
73     val other : ?kind:pair_kind -> descr -> descr
74     val is_product : ?kind:pair_kind -> descr -> bool
75 abate 1
76     (* List of non-empty rectangles *)
77     type t = (descr * descr) list
78 abate 19 val is_empty: t -> bool
79 abate 110 val get: ?kind:pair_kind -> descr -> t
80 abate 1 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 abate 110 val normal: ?kind:pair_kind -> descr -> normal
90 abate 19
91     val need_second: t -> bool
92     (* Is there more than a single rectangle ? *)
93 abate 1 end
94    
95     module Record : sig
96 abate 156 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 abate 1 val any : descr
105 abate 156 val project_field: t -> label -> descr
106     val project : descr -> label -> descr
107 abate 1
108 abate 156 (*
109 abate 1 (* List of maps label -> (optional, content) *)
110 abate 75 type t (* = (label, (bool * descr)) SortedMap.t list *)
111 abate 1 val get: descr -> t
112 abate 75 val descr: t -> descr
113 abate 1 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 abate 156 *)
119 abate 1
120     type normal =
121 abate 159 [ `Success (* { } *)
122     | `Fail (* Empty *)
123     | `NoField (* {| |} *)
124     | `SomeField (* { } \ {| |} *)
125 abate 1 | `Label of label * (descr * normal) list * normal ]
126 abate 75
127 abate 1 val normal: descr -> normal
128    
129 abate 160 val normal': t -> label -> (descr * t) list * t
130     val first_label: t -> [ `Success|`Fail|`NoField|`SomeField|`Label of label ]
131    
132 abate 156 (*
133 abate 1 val project : descr -> label -> descr
134     (* Raise Not_found if label is not necessarily present *)
135 abate 156 *)
136 abate 1 end
137    
138 abate 11 module Arrow : sig
139     val any : descr
140 abate 1
141 abate 19 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 abate 45 val check_iface: (descr * descr) list -> descr -> bool
150    
151 abate 11 type t
152 abate 19 val is_empty: t -> bool
153 abate 11 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 abate 19
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 abate 11 end
166    
167    
168 abate 16 module Int : sig
169 abate 45 val has_int : descr -> Big_int.big_int -> bool
170    
171 abate 16 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 abate 17 module Atom : sig
179     val has_atom : descr -> atom -> bool
180     end
181    
182 abate 45 module Char : sig
183     val has_char : descr -> Chars.Unichar.t -> bool
184 abate 58 val any : descr
185 abate 45 end
186    
187 abate 29 val normalize : descr -> descr
188 abate 1
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 abate 15 | Int of Big_int.big_int
199 abate 1 | Atom of atom
200 abate 13 | Char of Chars.Unichar.t
201 abate 110 | Pair of (t * t)
202     | Xml of (t * t)
203 abate 1 | Record of (label * t) list
204     | Fun of (node * node) list
205 abate 156 | Other
206 abate 1
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 abate 71
213     val print : Format.formatter -> t -> unit
214 abate 1 end
215    
216     module Print :
217     sig
218 abate 15 val register_global : string -> descr -> unit
219 abate 42 val print_const : Format.formatter -> const -> unit
220 abate 1 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