diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-30 09:39:04 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-30 09:39:04 +0200 |
commit | f9a6691243d59915dad8785a321ca021bb27de27 (patch) | |
tree | 3e0e662799d83a2d132d6950812dee3406d3d439 /src | |
parent | 58dfde37752f87e5df850ebe3a324dcb825fdb35 (diff) | |
download | bdl-f9a6691243d59915dad8785a321ca021bb27de27.tar.gz bdl-f9a6691243d59915dad8785a321ca021bb27de27.zip |
Add minimal syntax file for vim
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 | ||