mighty

The mighty programming language, compiler and tools (WIP)
Log | Files | Refs

commit 92ab0c31bd7175489d00a2f9e8195719ab2ca4c3
parent 9b3fef8bb151b5fba358db879c8cb9aad7dc1703
Author: citbl <citbl@citbl.org>
Date:   Thu, 21 May 2026 21:26:43 +1000

wip parser structure

Diffstat:
Mmtcc/src/main.c | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/mtcc/src/main.c b/mtcc/src/main.c @@ -2,6 +2,34 @@ #include "utils.h" #include "lexer.h" +struct scope { + void *tbd; +}; + +enum node_type { + NODE_PROGRAM = 100, + NODE_FUNC_DECL, +}; + +struct node { + enum node_type type; + struct token token; + struct scope *scope; + union { + struct { + struct node **declarations; + size_t len, cap; + } program; + }; +}; + +struct parser { + struct lexer *lexer; + struct node **nodes; + size_t nodes_len; + size_t nodes_cap; +}; + int main(int argc, char **argv) { const char *filename;