diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parser.c b/src/parser.c index e32a571..2215fad 100644 --- a/src/parser.c +++ b/src/parser.c | |||
@@ -375,12 +375,13 @@ parse_tree(Parser *parser, Errors *errors) { | |||
375 | 375 | ||
376 | Root * | 376 | Root * |
377 | parse(Token *tokens, Errors *errors) { | 377 | parse(Token *tokens, Errors *errors) { |
378 | // Build initial AST. | ||
379 | array_init(roots, 0); | 378 | array_init(roots, 0); |
380 | Parser parser = { | 379 | Parser parser = { |
381 | .tokens = tokens, | 380 | .tokens = tokens, |
382 | .current = 0, | 381 | .current = 0, |
383 | }; | 382 | }; |
383 | |||
384 | // Build initial ASTs. This also ensures the core grammar is correct. | ||
384 | while (has_next_token(&parser)) { | 385 | while (has_next_token(&parser)) { |
385 | Object *root = parse_tree(&parser, errors); | 386 | Object *root = parse_tree(&parser, errors); |
386 | OBJ_PRINT(root); | 387 | OBJ_PRINT(root); |
@@ -391,9 +392,8 @@ parse(Token *tokens, Errors *errors) { | |||
391 | } | 392 | } |
392 | 393 | ||
393 | // Perform semantic analysis. | 394 | // Perform semantic analysis. |
394 | // 1. Ensure core grammar is correct. | 395 | // TODO: Check that symbols are defined before usage. |
395 | // 2. Check that symbols are defined before usage. | 396 | // TODO: Remove unnecessary statements. |
396 | // 3. Remove unnecessary statements. | ||
397 | return roots; | 397 | return roots; |
398 | } | 398 | } |
399 | 399 | ||