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

Contents of /types/types.mli

Parent Directory Parent Directory | Revision Log Revision Log


Revision 18 - (show annotations)
Tue Jul 10 16:58:28 2007 UTC (5 years, 10 months ago) by abate
File size: 3581 byte(s)
[r2002-10-19 20:52:17 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-19 20:52:18+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 get: descr -> t
76 val pi1: t -> descr
77 val pi2: t -> descr
78
79 (* Intersection with (pi1,Any) *)
80 val restrict_1: t -> descr -> t
81
82 (* List of non-empty rectangles whose first projection
83 are pair-wise disjunct *)
84 type normal = t
85 val normal: descr -> t
86 end
87
88 module Record : sig
89 val any : descr
90
91 (* List of maps label -> (optional, content) *)
92 type t = (label, (bool * descr)) SortedMap.t list
93 val get: descr -> t
94 val is_empty: t -> bool
95 val restrict_label_present: t -> label -> t
96 val restrict_field: t -> label -> descr -> t
97 val restrict_label_absent: t -> label -> t
98 val project_field: t -> label -> descr
99
100 type normal =
101 [ `Success
102 | `Fail
103 | `Label of label * (descr * normal) list * normal ]
104 val normal: descr -> normal
105
106 val project : descr -> label -> descr
107 (* Raise Not_found if label is not necessarily present *)
108 end
109
110 module Arrow : sig
111 val any : descr
112
113 type t
114 val get: descr -> t
115 (* Always succeed; no check <= Arrow.any *)
116
117 val domain: t -> descr
118 val apply: t -> descr -> descr
119 (* Always succeed; no check on the domain *)
120 end
121
122
123 module Int : sig
124 val any : descr
125
126 val is_int : descr -> bool
127 val get: descr -> Intervals.t
128 val put: Intervals.t -> descr
129 end
130
131 module Atom : sig
132 val has_atom : descr -> atom -> bool
133 end
134
135 val normalize : node -> node
136
137 (** Subtyping and sample values **)
138
139 val is_empty : descr -> bool
140 val non_empty: descr -> bool
141 val subtype : descr -> descr -> bool
142
143 module Sample :
144 sig
145 type t =
146 | Int of Big_int.big_int
147 | Atom of atom
148 | Char of Chars.Unichar.t
149 | Pair of t * t
150 | Record of (label * t) list
151 | Fun of (node * node) list
152
153 val get : descr -> t
154 (**
155 Extract a sample value from a non empty type;
156 raise Not_found for an empty type
157 **)
158 end
159
160 module Print :
161 sig
162 val register_global : string -> descr -> unit
163
164 val print : Format.formatter -> node -> unit
165 val print_descr: Format.formatter -> descr -> unit
166 val print_sample : Format.formatter -> Sample.t -> unit
167 end
168
169 val check: descr -> unit

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