aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ast.h
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-03 20:27:16 +0900
committernsfisis <nsfisis@gmail.com>2025-09-03 20:27:16 +0900
commitf3a1ea57244608c1795e7f90cb3077c6a01686a9 (patch)
treebfa3d91dd15d5d42043c2ed8fbd717614931d748 /src/ast.h
parent5541c597cb68f76d1fc53e01b931eb870856843c (diff)
downloadducc-f3a1ea57244608c1795e7f90cb3077c6a01686a9.tar.gz
ducc-f3a1ea57244608c1795e7f90cb3077c6a01686a9.tar.zst
ducc-f3a1ea57244608c1795e7f90cb3077c6a01686a9.zip
feat: rewrite function declaration parsing
Diffstat (limited to 'src/ast.h')
-rw-r--r--src/ast.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ast.h b/src/ast.h
index 00b0171..f5fc98f 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -37,6 +37,7 @@ typedef enum {
TypeKind_enum,
TypeKind_ptr,
TypeKind_array,
+ TypeKind_func,
} TypeKind;
const char* type_kind_stringify(TypeKind k);
@@ -45,7 +46,7 @@ struct AstNode;
typedef struct AstNode AstNode;
typedef struct {
- struct AstNode* defs;
+ AstNode* defs;
size_t index;
} TypeRef;
@@ -56,6 +57,8 @@ typedef struct Type {
struct Type* base;
int array_size;
TypeRef ref;
+ struct Type* result;
+ AstNode* params;
} Type;
Type* type_new(TypeKind kind);
@@ -63,6 +66,7 @@ Type* type_new_ptr(Type* base);
Type* type_new_array(Type* elem, int size);
Type* type_new_static_string(int len);
Type* type_array_to_ptr(Type* ty);
+Type* type_new_func(Type* result, AstNode* params);
BOOL type_is_unsized(Type* ty);
int type_sizeof_struct(Type* ty);
@@ -141,7 +145,6 @@ typedef enum {
#define node_op __i1
#define node_stack_offset __i1
#define node_stack_size __i1
-#define node_function_is_static __i2
struct AstNode {
AstNodeKind kind;