From ef07fab261cce781ca750c1288574d4001f14bcf Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Sun, 30 Apr 2023 01:48:18 +0200 Subject: 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 Co-authored-by: Carlos Maniero --- src/pipac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/pipac.c') 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; } -- cgit v1.2.3