preliminary work on sea of nodes based intermediate representation.

This commit is contained in:
Lorenzo Torres 2025-12-07 16:48:48 +01:00
parent 989a32fa7b
commit 849e0b6863
13 changed files with 918 additions and 58 deletions

View file

@ -19,6 +19,7 @@ typedef enum {
OP_BXOR, // ^
OP_ASSIGN, // =
OP_ASSIGN_PTR, // <-
OP_RSHIFT_EQ, // >>=
OP_LSHIFT_EQ, // <<=
OP_PLUS_EQ, // +=
@ -126,6 +127,7 @@ typedef struct _ast_node {
node_type type;
source_pos position;
struct _type *expr_type;
bool address_taken; // used in IR generation.
union {
struct {
struct _ast_node *type;
@ -200,6 +202,12 @@ typedef struct _ast_node {
struct _ast_node *body;
u8 flags;
} whle; // while
struct {
struct _ast_node *condition;
struct _ast_node *body;
struct _ast_node *otherwise;
u8 flags;
} if_stmt; // while
struct {
struct _ast_node **statements;
usize stmt_len;