aboutsummaryrefslogtreecommitdiffstats
path: root/src/bootstrap/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/main.c')
-rwxr-xr-xsrc/bootstrap/main.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/bootstrap/main.c b/src/bootstrap/main.c
index 2d24f92..cfad9f1 100755
--- a/src/bootstrap/main.c
+++ b/src/bootstrap/main.c
@@ -6,25 +6,17 @@
6#include <stdlib.h> 6#include <stdlib.h>
7#include <string.h> 7#include <string.h>
8 8
9#include "string_view.c" 9#include "singletons.c"
10#include "read_line.c" 10
11#include "environment.c"
11#include "errors.c" 12#include "errors.c"
13#include "gc.c"
12#include "lexer.c" 14#include "lexer.c"
13#include "objects.c" 15#include "objects.c"
14#include "parser.c" 16#include "parser.c"
15#include "environment.c"
16#include "gc.c"
17#include "primitives.c" 17#include "primitives.c"
18 18#include "read_line.c"
19// 19#include "string_view.c"
20// Utility macros.
21//
22
23#define MAKE_SYM(STR) make_symbol((StringView){(STR), sizeof(STR) - 1})
24#define MAKE_ENV_VAR(ENV,STR,VAR) \
25 (env_add_symbol((ENV), MAKE_SYM(STR), (VAR)))
26#define MAKE_ENV_PROC(ENV,STR,FUN) \
27 (env_add_symbol((ENV), MAKE_SYM(STR), make_procedure(FUN)))
28 20
29void 21void
30init(void) { 22init(void) {
@@ -113,7 +105,7 @@ process_source(const StringView *source) {
113 .current = 0, 105 .current = 0,
114 }; 106 };
115 while (has_next_token(&visitor) && peek_token(&visitor).type != TOKEN_EOF) { 107 while (has_next_token(&visitor) && peek_token(&visitor).type != TOKEN_EOF) {
116 // check the stack before parsing 108 // Check the root node stack size before parsing
117 size_t root_stack_size = gc.roots.size; 109 size_t root_stack_size = gc.roots.size;
118 Object *root = parse_tree(&visitor); 110 Object *root = parse_tree(&visitor);
119 gc.roots.size = root_stack_size; 111 gc.roots.size = root_stack_size;