This repository has been archived by the owner on Nov 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
ast.mli
77 lines (69 loc) · 1.56 KB
/
ast.mli
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
69
70
71
72
73
74
75
76
(* first-class functions: functions are also values *)
type valuety =
(* Symbol to be bound^Wreplaced at the lookup stage: could be a
* plain value or a function *)
| Symbol of string
(* Bound symbol, like function argument: used in the name
* binding-propagation stage *)
| Variable of varty
(* Literal values *)
| Int of int
| Bool of bool
| Double of float
| Char of char
| String of string
| Array of valuety list
| Nil
(* Functions *)
| Isbool of isboolty
| Isint of isintty
| Defn of defnty
| Def of defty
| Defmacro of defmacroty
and varty =
{
var_name : string;
var_value : valuety;
}
and isboolty =
{
isbool_argument : valuety;
isbool_return : bool;
}
and isintty =
{
isint_argument : valuety;
isint_return : bool;
}
and defnty =
{
defn_name : string;
defn_arguments : varty list;
defn_return : valuety;
defn_restplaceholder : valuety list option;
(* temporary reprise *)
defn_sexpr : Parsetree.sexpr;
}
and defty =
{
def_name : string;
def_body : valuety;
(* temporary reprise *)
def_sexpr : Parsetree.sexpr;
}
(* exact same type as defnty, except that it has "eval" instead of "return" *)
and defmacroty =
{
defmacro_name : string option;
defmacro_arguments : varty list;
defmacro_return : valuety;
defmacro_restplaceholder : valuety list option;
(* temporary reprise *)
defmacro_sexpr : Parsetree.sexpr;
}
and anonfunty =
{
anonfn_return : valuety;
(* temporary reprise *)
anonfn_sexpr : Parsetree.sexpr;
}