-
Notifications
You must be signed in to change notification settings - Fork 0
/
pointsto.mlog
47 lines (30 loc) · 857 Bytes
/
pointsto.mlog
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
module type PROGRAM = sig
type variable
type object
type fieldname
alloc : variable * object
assign : variable * variable
fread : variable * variable * fieldname
fwrite : variable * fieldname * variable
end
module PointsTo (P : PROGRAM) = struct
define
ptsto : P.variable * P.object
ptsto(?v,?o) :- P.alloc(?v,?o)
ptsto(?v,?o) :- P.assign(?v,?v2), ptsto(?v2,?o)
ptsto(?v,?o) :- P.fread(?v,?v2,?f), ptsto(?v2,?o2), fptsto(?o2,?f,?o)
and
fptsto : P.object * P.fieldname * P.object
fptsto(?o,?f,?o2) :- P.fwrite(?v,?f,?v2), ptsto(?v,?o), ptsto(?v2,?o2)
end
module TestProg = struct
type variable = int
type object = int
type fieldname = int
define
alloc : int * int
and assign : int * int
and fread : int * int * int
and fwrite : int * int * int
end
module P = PointsTo (TestProg)