diff options
-rw-r--r-- | TODO.md | 13 | ||||
-rw-r--r-- | src/main.c | 19 | ||||
-rw-r--r-- | src/parser.c | 9 |
3 files changed, 16 insertions, 25 deletions
@@ -0,0 +1,13 @@ | |||
1 | # Currently open issues | ||
2 | |||
3 | - [] Fill up symbol tables/environments/types. | ||
4 | - [] Add symbol name checking (first pass should fill symbol names on global | ||
5 | scope so that we can use global functions/variables before they are inside | ||
6 | procedures even when those come first). | ||
7 | - [] Add type checking. | ||
8 | - [] Support output dot files for visualizing internal data structures with | ||
9 | `graphviz` | ||
10 | - [] Use bump allocators to avoid a large number of `malloc` calls. | ||
11 | - [] Free memory. Not important for now, since it will be cleaned up at exit. | ||
12 | - [] Add structs. | ||
13 | - [] Add arrays and darrays. | ||
@@ -26,30 +26,11 @@ void | |||
26 | process_source(const StringView *source, const char *file_name) { | 26 | process_source(const StringView *source, const char *file_name) { |
27 | // Read tokens. | 27 | // Read tokens. |
28 | Token *tokens = tokenize(source); | 28 | Token *tokens = tokenize(source); |
29 | // print_tokens(tokens); | ||
30 | check_errors(file_name); | 29 | check_errors(file_name); |
31 | 30 | ||
32 | // Parser. | 31 | // Parser. |
33 | parse(tokens); | 32 | parse(tokens); |
34 | // print_program(program); | ||
35 | check_errors(file_name); | 33 | check_errors(file_name); |
36 | |||
37 | // if (errors.n != 0) { | ||
38 | // report_errors(&errors, file_name); | ||
39 | // free_objects(); | ||
40 | // array_free(tokens); | ||
41 | // exit(EXIT_FAILURE); | ||
42 | // } | ||
43 | // array_free(tokens); | ||
44 | |||
45 | // // TODO: Optimization. | ||
46 | |||
47 | // // Compilation. | ||
48 | // ProgramIr program_ir = compile(program); | ||
49 | // (void)program_ir; | ||
50 | |||
51 | // // Free resources. | ||
52 | // free_objects(); | ||
53 | } | 34 | } |
54 | 35 | ||
55 | void | 36 | void |
diff --git a/src/parser.c b/src/parser.c index b76e32f..2c1c24f 100644 --- a/src/parser.c +++ b/src/parser.c | |||
@@ -198,8 +198,8 @@ parse_def(Parser *parser) { | |||
198 | return NULL; | 198 | return NULL; |
199 | } | 199 | } |
200 | 200 | ||
201 | // TODO: Making type checking mandatory for now until we introduce | 201 | // TODO: Making type definitions mandatory for now until we introduce type |
202 | // type inference. | 202 | // inference. |
203 | Node *type = parse_type(parser); | 203 | Node *type = parse_type(parser); |
204 | if (type == NULL) { | 204 | if (type == NULL) { |
205 | return NULL; | 205 | return NULL; |
@@ -364,7 +364,6 @@ parse_paren(Parser *parser) { | |||
364 | default: break; | 364 | default: break; |
365 | } | 365 | } |
366 | 366 | ||
367 | // TODO: Lookup value on symbol table. | ||
368 | push_error(ERR_TYPE_PARSER, ERR_UNIMPLEMENTED, tok.line, tok.col); | 367 | push_error(ERR_TYPE_PARSER, ERR_UNIMPLEMENTED, tok.line, tok.col); |
369 | return NULL; | 368 | return NULL; |
370 | } | 369 | } |
@@ -418,9 +417,7 @@ parse(Token *tokens) { | |||
418 | 417 | ||
419 | // DEBUG: TOKENS | 418 | // DEBUG: TOKENS |
420 | printf("-- tokens --\n"); | 419 | printf("-- tokens --\n"); |
421 | for (size_t i = 0; i < array_size(tokens); i++) { | 420 | print_tokens(parser.tokens); |
422 | print_token(tokens[i]); | ||
423 | } | ||
424 | printf("------------\n"); | 421 | printf("------------\n"); |
425 | 422 | ||
426 | while (has_next(&parser)) { | 423 | while (has_next(&parser)) { |