commit bb58229d059a69fec4f6c26f8514b3406028840c
parent 92ab0c31bd7175489d00a2f9e8195719ab2ca4c3
Author: citbl <citbl@citbl.org>
Date: Thu, 21 May 2026 21:31:49 +1000
wip parser structure 2
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mtcc/src/main.c b/mtcc/src/main.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdbool.h>
#include "utils.h"
#include "lexer.h"
@@ -16,10 +17,11 @@ struct node {
struct token token;
struct scope *scope;
union {
- struct {
- struct node **declarations;
- size_t len, cap;
- } program;
+ /* clang-format off */
+ struct { struct node **declarations; size_t len, cap; } program;
+ struct { struct node* return_type; struct node** params; size_t p_len, p_cap; struct node* body; bool is_public; } func_decl;
+ struct { struct node* type; } func_decl_param;
+ /* clang-format on */
};
};