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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 75 - (hide annotations)
Tue Jul 10 17:03:57 2007 UTC (5 years, 10 months ago) by abate
File size: 4794 byte(s)
[r2002-11-02 19:24:08 by cvscast] Empty log message

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

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