-
Notifications
You must be signed in to change notification settings - Fork 0
/
t.go
58 lines (48 loc) · 752 Bytes
/
t.go
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
package snoc
type Any interface{}
type Terp struct {
Globals map[*Sym]Any
}
type Env struct {
Proto *ProtoFunc
Up *Env
Slots []Any
Terp *Terp
}
type ProtoFunc struct {
Outer *ProtoFunc
Params []*Sym
Values []Any // Only for Let
Body Any
Name string
IsLet bool
}
type Func struct {
Outer *Env
Params []*Sym
Values []Any // Only for Let
Body Any
Name string
IsLet bool
Proto *ProtoFunc
}
type Var struct {
Proto *ProtoFunc
Slot int
Sym *Sym
}
type Sym struct {
S string
}
type Pair struct {
H Any
T *Pair
}
type Prim struct {
Name string
F func(args []Any, env *Env) Any // args are evaluated.
}
type Special struct {
Name string
F func(args []Any, env *Env) Any // args are unevaluated.
}