-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroots.h
53 lines (45 loc) · 782 Bytes
/
roots.h
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
typedef enum {
false,
true,
} bool;
bool balanced(char* expr);
char* get_line();
typedef enum {
Number,
Symbol,
ConsCell,
Lambda,
Nil,
Truth
} TypeTag;
typedef struct _value Value;
typedef struct _closure Closure;
typedef struct _cons Cons;
typedef union _data Data;
struct _value {
union _data {
int number;
Cons *list;
char *symbol;
Closure *closure;
} data;
TypeTag tag;
};
struct _cons {
Value head;
Value tail;
};
struct _closure {
Value bindings;
Value body;
Value env;
};
Value read(char *string);
Value eval(Value arg, Value env);
Value eval_mutating_env(Value arg, Value* env);
void print(Value v);
void annotate(Value l, char* annotation);
void repl();
Value nil();
bool empty(Value v);
Value eq(Value a, Value b);