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
48
49
50
open Forester_prelude
open Base
open struct module T = Types end
module String_map = Map.Make(String)
module Symbol_map = Map.Make(Symbol)
type t =
| Content of T.content
| Clo of (t String_map.t [@opaque]) * string option binding list * Syn.t
| Dx_prop of (string, T.content T.vertex) Datalog_expr.prop
| Dx_sequent of (string, T.content T.vertex) Datalog_expr.sequent
| Dx_query of (string, T.content T.vertex) Datalog_expr.query
| Dx_var of string
| Dx_const of Vertex.t
| Sym of Symbol.t
| Obj of Symbol.t
[@@deriving show]
type obj_method = {
body: Syn.t;
self: string option;
super: string option;
env: t String_map.t [@opaque]
}
[@@deriving show]
module Method_table = struct
include Map.Make(String)
let pp (pp_el : Format.formatter -> 'a -> unit) (fmt : Format.formatter) (map : 'a t) =
Format.fprintf fmt "@[<v1>{";
begin
let@ k, v = Seq.iter @~ to_seq map in
Format.fprintf fmt "@[%s ~> %a@]@;" k pp_el v
end;
Format.fprintf fmt "}@]"
end
type obj = {
prototype: Symbol.t option;
methods: obj_method Method_table.t
}
[@@deriving show]