-
Notifications
You must be signed in to change notification settings - Fork 0
/
closure.sig
executable file
·68 lines (65 loc) · 1.98 KB
/
closure.sig
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
signature CLOSURE =
sig
structure PrimOp:
sig
datatype t
= Print
| Add
| Sub
| Times
| Int2String
val pp: t -> unit
end
datatype t
= LetVal of {name: string
, value: v , body: t}
| Let of {name: string, index: int
, tuple: string, body: t}
| LetCont of {cont: string
, env: string
, arg: string
, fbody: t
, body: t
, freevars: string list}
| ContApp of {cont: string
, env: string
, arg: string}
| FuncApp of {func: string
, cont: string
, env: string
, arg: string}
| Case of {cond: string
, thenarg: string
, thenn: t
, elsearg: string
, elsee: t}
| LetPrim of {name: string
, opr: PrimOp.t
, args: string list
, body: t}
| If0 of {cond: string
, thenn: t
, elsee: t}
| LetFix of {func :string
, env: string
, cont: string
, arg: string
, fbody: t
, body: t
, freevars: string list}
| Exit of string
and v
= Empty
| Num of int
| String of string
| Tuple of string list
| Tag of {label: int
, name: string}
| FuncVal of {env: string
, cont: string
, arg: string
, fbody: t
, freevars: string list}
val dump2file : t * string -> unit
val pp : t -> unit
end