diff options
Diffstat (limited to 'src/bootstrap/main.c')
-rwxr-xr-x | src/bootstrap/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bootstrap/main.c b/src/bootstrap/main.c index 5191fd0..575a924 100755 --- a/src/bootstrap/main.c +++ b/src/bootstrap/main.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | #include <getopt.h> | 2 | #include <getopt.h> |
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <stdint.h> | ||
4 | #include <stdio.h> | 5 | #include <stdio.h> |
5 | #include <stdlib.h> | 6 | #include <stdlib.h> |
6 | #include <string.h> | 7 | #include <string.h> |
@@ -12,6 +13,7 @@ | |||
12 | #include "objects.c" | 13 | #include "objects.c" |
13 | #include "parser.c" | 14 | #include "parser.c" |
14 | #include "environment.c" | 15 | #include "environment.c" |
16 | #include "gc.c" | ||
15 | #include "primitives.c" | 17 | #include "primitives.c" |
16 | 18 | ||
17 | // | 19 | // |
@@ -26,6 +28,9 @@ | |||
26 | 28 | ||
27 | void | 29 | void |
28 | init(void) { | 30 | init(void) { |
31 | // Initialize garbage collector. | ||
32 | init_gc(); | ||
33 | |||
29 | // Initialize singletons. | 34 | // Initialize singletons. |
30 | obj_nil = alloc_object(OBJ_TYPE_NIL); | 35 | obj_nil = alloc_object(OBJ_TYPE_NIL); |
31 | obj_true = alloc_object(OBJ_TYPE_BOOL); | 36 | obj_true = alloc_object(OBJ_TYPE_BOOL); |
@@ -99,7 +104,6 @@ process_source(const StringView *source) { | |||
99 | while (has_next_token(&visitor) && peek_token(&visitor).type != TOKEN_EOF) { | 104 | while (has_next_token(&visitor) && peek_token(&visitor).type != TOKEN_EOF) { |
100 | Object *root = parse_tree(&visitor); | 105 | Object *root = parse_tree(&visitor); |
101 | if (root == obj_err || errors_n != 0) { | 106 | if (root == obj_err || errors_n != 0) { |
102 | free_objects(root); | ||
103 | break; | 107 | break; |
104 | } | 108 | } |
105 | 109 | ||
@@ -109,7 +113,6 @@ process_source(const StringView *source) { | |||
109 | display(result); | 113 | display(result); |
110 | printf("\n"); | 114 | printf("\n"); |
111 | } | 115 | } |
112 | free_objects(root); | ||
113 | } | 116 | } |
114 | 117 | ||
115 | if (tokens.buf != NULL) { | 118 | if (tokens.buf != NULL) { |