diff options
author | Johnny Richard <johnny@johnnyrichard.com> | 2023-04-30 01:48:18 +0200 |
---|---|---|
committer | Johnny Richard <johnny@johnnyrichard.com> | 2023-04-30 01:55:29 +0200 |
commit | ef07fab261cce781ca750c1288574d4001f14bcf (patch) | |
tree | 9b4da44aee7cc64cec448adeee31b38e12d29e6d /src/pipac.c | |
parent | 88a08db927629032d6d4c662e00f0dce2c112ce4 (diff) |
parser: Registry identifiers on scope
We are parsing variables/functions and checking if they are defined on
scope. Otherwise we fail the parsing with a nice message.
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Co-authored-by: Carlos Maniero <carlosmaniero@gmail.com>
Diffstat (limited to 'src/pipac.c')
-rw-r--r-- | src/pipac.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pipac.c b/src/pipac.c index b31b8b5..2041218 100644 --- a/src/pipac.c +++ b/src/pipac.c @@ -22,6 +22,7 @@ #include "gas_assembly_generator.h" #include "lexer.h" #include "parser.h" +#include "scope.h" #include "string_view.h" static void @@ -62,8 +63,9 @@ main(int argc, char **argv) lexer_t lexer; lexer_init(&lexer, filepath); + scope_t *scope = scope_new(); parser_t parser; - parser_init(&parser, &lexer); + parser_init(&parser, &lexer, scope); ast_node_t *func = ast_node_new(); @@ -74,6 +76,7 @@ main(int argc, char **argv) generate_gas_x86_64_linux(func); + scope_destroy(scope); ast_node_destroy(func); return EXIT_SUCCESS; } |