-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.h
More file actions
58 lines (51 loc) · 1.03 KB
/
main.h
File metadata and controls
58 lines (51 loc) · 1.03 KB
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
#define LAM 0
#define APP 1
#define VAR 2
#define RET 3
#define LIT 4
#define CAP 5
#define OWN 6
#define ARR 7
#define GET 8
#define SET 9
#define FST 10
#define SND 11
#define LET 12
#define LEN 13
#define ADD 14
#define SUB 15
#define MUL 16
#define DIV 17
#define MOD 18
#define EQL 19
#define GRT 20
#define AND 21
#define NOT 23
#define JIF 24
#define REP 25
#define BRK 26
#define CNT 27
#define PAR 28
#define SYS 29
#define CUT 30
struct Value {
int type;
union {
struct {
int f;
struct Value *env;
int env_size;
} closure;
double number;
struct {
int size;
struct Value *values;
} array;
};
};
int equal(struct Value *a, struct Value *b);
void free_all(struct Value *env, int env_size);
void free_all_except(struct Value *env, int env_size, struct Value *except);
void clone(struct Value *dest, struct Value *src);
void print_value_stack(struct Value *value_stack, int value_stack_size);
void print_value(struct Value *value);