-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaval.ml
More file actions
27 lines (24 loc) · 722 Bytes
/
Copy pathaval.ml
File metadata and controls
27 lines (24 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
open Types
module type AVAL = sig
val aval : prim_value -> value
end
module ConcreteAval = struct
let aval v = AbsUnique v
end
module AbstractAval = struct
let rec abstract_cons car cdr length =
if length = 0 then
AbsList
else match cdr with
| AbsUnique (Cons (cdar, cddr)) ->
AbsUnique (Cons (car, abstract_cons cdar cddr (length-1)))
| _ -> AbsUnique (Cons (car, cdr))
let aval = function
(* some values are directly abstracted, to avoid having infinite width in
* the value lattice *)
| String _ -> AbsString
| Integer _ -> AbsInteger
| Symbol _ -> AbsSymbol
| Cons (car, cdr) -> abstract_cons car cdr !Params.list_length
| v -> AbsUnique v
end