From dc210e409cca65b2efdc22fe03a3095ff10323b6 Mon Sep 17 00:00:00 2001 From: omicron Date: Mon, 7 Apr 2025 12:50:39 +0200 Subject: [PATCH 01/14] fix parse_immediate to accept label_reference instead of identifier --- src/parser/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/parser.c b/src/parser/parser.c index f3db142..7e60c81 100644 --- a/src/parser/parser.c +++ b/src/parser/parser.c @@ -83,7 +83,7 @@ parse_result_t parse_register_expression(tokenlist_entry_t *current) { } parse_result_t parse_immediate(tokenlist_entry_t *current) { - parser_t parsers[] = {parse_number, parse_identifier, nullptr}; + parser_t parsers[] = {parse_number, parse_label_reference, nullptr}; parse_result_t result = parse_any(current, parsers); return parse_result_wrap(NODE_IMMEDIATE, result); } -- 2.47.2 From d3d69b82d513d0e32866a12106942594e0748b2d Mon Sep 17 00:00:00 2001 From: omicron Date: Mon, 7 Apr 2025 10:49:57 +0200 Subject: [PATCH 02/14] Add .import and .export directive to the grammar and parser --- doc/parser_grammar.txt | 6 +++++- src/ast.c | 8 ++++++++ src/ast.h | 4 ++++ src/parser/parser.c | 18 +++++++++++++++++- src/parser/primitives.c | 16 ++++++++++++++++ src/parser/primitives.h | 2 ++ 6 files changed, 52 insertions(+), 2 deletions(-) diff --git a/doc/parser_grammar.txt b/doc/parser_grammar.txt index 9a651b9..00c7275 100644 --- a/doc/parser_grammar.txt +++ b/doc/parser_grammar.txt @@ -3,10 +3,14 @@