From 4f9d0247549b06ddb25b76bb425541190105cb48 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Sun, 26 Jul 2026 19:20:30 -0700 Subject: functioning type system perhaps? --- ast.h | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'ast.h') diff --git a/ast.h b/ast.h index c41713d..18c0fd3 100644 --- a/ast.h +++ b/ast.h @@ -1,15 +1,12 @@ #ifndef AST_H #define AST_H +#include "type.h" #include "scope.h" struct stmt_node; struct expr_node; -struct type_ref_node { - struct type_ref type; -}; - struct int_lit_node { integral_t val; }; @@ -31,7 +28,7 @@ struct var_ref_node { }; struct var_decl_node { - struct type_ref_node type; + struct type type; struct var_def* def_ref; struct expr_node* initial_value; }; @@ -94,7 +91,7 @@ struct expr_node { struct binary_node binary; } inner; - const struct type_def* resolved_type; + struct type* resolved_type; }; struct group_node { @@ -108,13 +105,11 @@ struct decl_list_node { }; struct fn_decl_node { - struct type_ref_node return_type; - char* name; + struct type return_type; + const char* name; struct decl_list_node* args; struct group_node body; struct scope* scope; - - const struct type_def* resolved_return_type; }; struct return_node { @@ -183,13 +178,6 @@ struct root_node { struct ast { struct root_node* root_node; struct scope* root_scope; - - /* nice shortcuts to have */ - const struct type_def* void_type; - const struct type_def* char_type; - const struct type_def* integral_type; - const struct type_def* decimal_type; - const struct type_def* pointer_type; }; void ast_destroy(struct ast* ast); -- cgit v1.2.3