| 1 |
abate |
233 |
open Ident
|
| 2 |
|
|
|
| 3 |
abate |
222 |
type const = | Integer of Intervals.v
|
| 4 |
|
|
| Atom of Atoms.v
|
| 5 |
|
|
| Char of Chars.v
|
| 6 |
abate |
1 |
|
| 7 |
abate |
271 |
val compare_const: const -> const -> int
|
| 8 |
|
|
val hash_const: const -> int
|
| 9 |
abate |
276 |
val equal_const: const -> const -> bool
|
| 10 |
abate |
271 |
|
| 11 |
abate |
1 |
(** Algebra **)
|
| 12 |
|
|
|
| 13 |
|
|
type node
|
| 14 |
|
|
type descr
|
| 15 |
|
|
|
| 16 |
|
|
val make: unit -> node
|
| 17 |
|
|
val define: node -> descr -> unit
|
| 18 |
|
|
|
| 19 |
|
|
val cons: descr -> node
|
| 20 |
|
|
val internalize: node -> node
|
| 21 |
|
|
|
| 22 |
|
|
val id: node -> int
|
| 23 |
|
|
val descr: node -> descr
|
| 24 |
|
|
|
| 25 |
abate |
16 |
val equal_descr: descr -> descr -> bool
|
| 26 |
|
|
val hash_descr: descr -> int
|
| 27 |
abate |
271 |
val compare_descr: descr -> descr -> int
|
| 28 |
abate |
1 |
|
| 29 |
abate |
17 |
module DescrHash: Hashtbl.S with type key = descr
|
| 30 |
abate |
271 |
module DescrSList: SortedList.S with type 'a elem = descr
|
| 31 |
abate |
68 |
module DescrMap: Map.S with type key = descr
|
| 32 |
abate |
17 |
|
| 33 |
abate |
68 |
(* Note: it seems that even for non-functional data, DescrMap
|
| 34 |
|
|
is more efficient than DescrHash ... *)
|
| 35 |
|
|
|
| 36 |
abate |
1 |
(** Boolean connectives **)
|
| 37 |
|
|
|
| 38 |
|
|
val cup : descr -> descr -> descr
|
| 39 |
|
|
val cap : descr -> descr -> descr
|
| 40 |
|
|
val diff : descr -> descr -> descr
|
| 41 |
|
|
val neg : descr -> descr
|
| 42 |
|
|
val empty : descr
|
| 43 |
|
|
val any : descr
|
| 44 |
|
|
|
| 45 |
abate |
167 |
val any_node : node
|
| 46 |
|
|
|
| 47 |
abate |
1 |
(** Constructors **)
|
| 48 |
|
|
|
| 49 |
abate |
110 |
type pair_kind = [ `Normal | `XML ]
|
| 50 |
|
|
|
| 51 |
abate |
52 |
val interval : Intervals.t -> descr
|
| 52 |
abate |
222 |
val atom : Atoms.t -> descr
|
| 53 |
abate |
1 |
val times : node -> node -> descr
|
| 54 |
abate |
110 |
val xml : node -> node -> descr
|
| 55 |
abate |
1 |
val arrow : node -> node -> descr
|
| 56 |
abate |
229 |
val record : label -> node -> descr
|
| 57 |
abate |
233 |
val record' : bool * node label_map -> descr
|
| 58 |
abate |
18 |
val char : Chars.t -> descr
|
| 59 |
abate |
1 |
val constant : const -> descr
|
| 60 |
|
|
|
| 61 |
|
|
(** Positive systems and least solutions **)
|
| 62 |
|
|
|
| 63 |
|
|
module Positive :
|
| 64 |
|
|
sig
|
| 65 |
|
|
type v
|
| 66 |
|
|
val forward: unit -> v
|
| 67 |
|
|
val define: v -> v -> unit
|
| 68 |
|
|
val ty: descr -> v
|
| 69 |
|
|
val cup: v list -> v
|
| 70 |
|
|
val times: v -> v -> v
|
| 71 |
abate |
263 |
val xml: v -> v -> v
|
| 72 |
abate |
1 |
|
| 73 |
|
|
val solve: v -> node
|
| 74 |
|
|
end
|
| 75 |
|
|
|
| 76 |
|
|
(** Normalization **)
|
| 77 |
|
|
|
| 78 |
|
|
module Product : sig
|
| 79 |
|
|
val any : descr
|
| 80 |
abate |
110 |
val any_xml : descr
|
| 81 |
|
|
val other : ?kind:pair_kind -> descr -> descr
|
| 82 |
|
|
val is_product : ?kind:pair_kind -> descr -> bool
|
| 83 |
abate |
1 |
|
| 84 |
|
|
(* List of non-empty rectangles *)
|
| 85 |
|
|
type t = (descr * descr) list
|
| 86 |
abate |
19 |
val is_empty: t -> bool
|
| 87 |
abate |
110 |
val get: ?kind:pair_kind -> descr -> t
|
| 88 |
abate |
1 |
val pi1: t -> descr
|
| 89 |
|
|
val pi2: t -> descr
|
| 90 |
abate |
229 |
val pi2_restricted: descr -> t -> descr
|
| 91 |
abate |
1 |
|
| 92 |
|
|
(* Intersection with (pi1,Any) *)
|
| 93 |
|
|
val restrict_1: t -> descr -> t
|
| 94 |
|
|
|
| 95 |
|
|
(* List of non-empty rectangles whose first projection
|
| 96 |
|
|
are pair-wise disjunct *)
|
| 97 |
|
|
type normal = t
|
| 98 |
abate |
110 |
val normal: ?kind:pair_kind -> descr -> normal
|
| 99 |
abate |
19 |
|
| 100 |
|
|
val need_second: t -> bool
|
| 101 |
|
|
(* Is there more than a single rectangle ? *)
|
| 102 |
abate |
1 |
end
|
| 103 |
|
|
|
| 104 |
|
|
module Record : sig
|
| 105 |
abate |
229 |
val any : descr
|
| 106 |
|
|
val or_absent: descr -> descr
|
| 107 |
|
|
val any_or_absent: descr
|
| 108 |
|
|
|
| 109 |
|
|
val has_absent: descr -> bool
|
| 110 |
|
|
val has_record: descr -> bool
|
| 111 |
|
|
|
| 112 |
|
|
val split : descr -> label -> Product.t
|
| 113 |
|
|
val split_normal : descr -> label -> Product.normal
|
| 114 |
|
|
|
| 115 |
|
|
val project : descr -> label -> descr
|
| 116 |
|
|
(* Raise Not_found if label is not necessarily present *)
|
| 117 |
|
|
|
| 118 |
abate |
242 |
val condition : descr -> label -> descr -> descr
|
| 119 |
|
|
(* condition t1 l t2 : What must follow if field l hash type t2 *)
|
| 120 |
|
|
val project_opt : descr -> label -> descr
|
| 121 |
|
|
val has_empty_record: descr -> bool
|
| 122 |
|
|
|
| 123 |
|
|
|
| 124 |
abate |
229 |
val first_label: descr -> label
|
| 125 |
|
|
|
| 126 |
|
|
val empty_cases: descr -> bool * bool
|
| 127 |
|
|
|
| 128 |
abate |
240 |
val merge: descr -> descr -> descr
|
| 129 |
|
|
val remove_field: descr -> label -> descr
|
| 130 |
abate |
1 |
end
|
| 131 |
|
|
|
| 132 |
abate |
11 |
module Arrow : sig
|
| 133 |
|
|
val any : descr
|
| 134 |
abate |
1 |
|
| 135 |
abate |
19 |
val check_strenghten: descr -> descr -> descr
|
| 136 |
|
|
(* [check_strenghten t s]
|
| 137 |
|
|
Assume that [t] is an intersection of arrow types
|
| 138 |
|
|
representing the interface of an abstraction;
|
| 139 |
|
|
check that this abstraction has type [s] (otherwise raise Not_found)
|
| 140 |
|
|
and returns a refined type for this abstraction.
|
| 141 |
|
|
*)
|
| 142 |
|
|
|
| 143 |
abate |
45 |
val check_iface: (descr * descr) list -> descr -> bool
|
| 144 |
|
|
|
| 145 |
abate |
11 |
type t
|
| 146 |
abate |
19 |
val is_empty: t -> bool
|
| 147 |
abate |
11 |
val get: descr -> t
|
| 148 |
|
|
(* Always succeed; no check <= Arrow.any *)
|
| 149 |
|
|
|
| 150 |
|
|
val domain: t -> descr
|
| 151 |
|
|
val apply: t -> descr -> descr
|
| 152 |
|
|
(* Always succeed; no check on the domain *)
|
| 153 |
abate |
19 |
|
| 154 |
|
|
val need_arg : t -> bool
|
| 155 |
|
|
(* True if the type of the argument is needed to obtain
|
| 156 |
|
|
the type of the result (must use [apply]; otherwise,
|
| 157 |
|
|
[apply_noarg] is enough *)
|
| 158 |
|
|
val apply_noarg : t -> descr
|
| 159 |
abate |
11 |
end
|
| 160 |
|
|
|
| 161 |
|
|
|
| 162 |
abate |
16 |
module Int : sig
|
| 163 |
abate |
222 |
val has_int : descr -> Intervals.v -> bool
|
| 164 |
abate |
45 |
|
| 165 |
abate |
16 |
val any : descr
|
| 166 |
|
|
|
| 167 |
|
|
val is_int : descr -> bool
|
| 168 |
|
|
val get: descr -> Intervals.t
|
| 169 |
|
|
val put: Intervals.t -> descr
|
| 170 |
|
|
end
|
| 171 |
|
|
|
| 172 |
abate |
17 |
module Atom : sig
|
| 173 |
abate |
222 |
val has_atom : descr -> Atoms.v -> bool
|
| 174 |
abate |
243 |
val get: descr -> Atoms.t
|
| 175 |
abate |
17 |
end
|
| 176 |
|
|
|
| 177 |
abate |
45 |
module Char : sig
|
| 178 |
abate |
222 |
val has_char : descr -> Chars.v -> bool
|
| 179 |
abate |
58 |
val any : descr
|
| 180 |
abate |
243 |
val get: descr -> Chars.t
|
| 181 |
abate |
45 |
end
|
| 182 |
|
|
|
| 183 |
abate |
29 |
val normalize : descr -> descr
|
| 184 |
abate |
1 |
|
| 185 |
|
|
(** Subtyping and sample values **)
|
| 186 |
|
|
|
| 187 |
|
|
val is_empty : descr -> bool
|
| 188 |
|
|
val non_empty: descr -> bool
|
| 189 |
|
|
val subtype : descr -> descr -> bool
|
| 190 |
|
|
|
| 191 |
|
|
module Sample :
|
| 192 |
|
|
sig
|
| 193 |
abate |
252 |
type t
|
| 194 |
abate |
1 |
|
| 195 |
|
|
val get : descr -> t
|
| 196 |
|
|
(**
|
| 197 |
|
|
Extract a sample value from a non empty type;
|
| 198 |
|
|
raise Not_found for an empty type
|
| 199 |
|
|
**)
|
| 200 |
abate |
71 |
|
| 201 |
|
|
val print : Format.formatter -> t -> unit
|
| 202 |
abate |
1 |
end
|
| 203 |
|
|
|
| 204 |
|
|
module Print :
|
| 205 |
|
|
sig
|
| 206 |
abate |
15 |
val register_global : string -> descr -> unit
|
| 207 |
abate |
42 |
val print_const : Format.formatter -> const -> unit
|
| 208 |
abate |
1 |
val print : Format.formatter -> node -> unit
|
| 209 |
|
|
val print_descr: Format.formatter -> descr -> unit
|
| 210 |
|
|
end
|
| 211 |
|
|
|
| 212 |
abate |
186 |
val print_stat: Format.formatter -> unit
|