diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-05-23 23:58:30 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-05-23 23:58:30 +0330 |
commit | 3c9aea642e3b2f4083705f1cd42fa911d35ee696 (patch) | |
tree | d990b2ffdb63161a9aef7cce20e5714461f86085 /src/compiler/ast-tree.h | |
parent | 093c3bece426686b175db9ddaecd6abc8908fd87 (diff) |
add way to call C functions
Diffstat (limited to 'src/compiler/ast-tree.h')
-rw-r--r-- | src/compiler/ast-tree.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/compiler/ast-tree.h b/src/compiler/ast-tree.h index d05db7b..ff8529e 100644 --- a/src/compiler/ast-tree.h +++ b/src/compiler/ast-tree.h @@ -61,6 +61,8 @@ typedef enum AstTreeToken { AST_TREE_TOKEN_TYPE_CODE, AST_TREE_TOKEN_TYPE_NAMESPACE, AST_TREE_TOKEN_TYPE_SHAPE_SHIFTER, + AST_TREE_TOKEN_TYPE_C_LIBRARY, + AST_TREE_TOKEN_TYPE_C_FUNCTION, AST_TREE_TOKEN_TYPE_BOOL, AST_TREE_TOKEN_VALUE_VOID, AST_TREE_TOKEN_STATIC_VARS_END = AST_TREE_TOKEN_VALUE_VOID, @@ -72,6 +74,8 @@ typedef enum AstTreeToken { AST_TREE_TOKEN_VALUE_UNDEFINED, AST_TREE_TOKEN_VALUE_NAMESPACE, AST_TREE_TOKEN_VALUE_SHAPE_SHIFTER, + AST_TREE_TOKEN_VALUE_C_LIBRARY, + AST_TREE_TOKEN_VALUE_C_FUNCTION, AST_TREE_TOKEN_VALUE_INT, AST_TREE_TOKEN_VALUE_FLOAT, AST_TREE_TOKEN_VALUE_BOOL, @@ -139,6 +143,7 @@ extern AstTree AST_TREE_F128_TYPE; extern AstTree AST_TREE_CODE_TYPE; extern AstTree AST_TREE_NAMESPACE_TYPE; extern AstTree AST_TREE_SHAPE_SHIFTER_TYPE; +extern AstTree AST_TREE_C_LIBRARY_TYPE; extern AstTree AST_TREE_VOID_VALUE; typedef struct AstTreeVariable { @@ -313,6 +318,20 @@ typedef struct AstTreeLoopControl { typedef struct AstTreeRawValue { } AstTreeRawValue; +typedef struct AstTreeCFunctionType { + AstTree *funcType; +} AstTreeCFunctionType; + +typedef struct AstTreeCLibrary { + void *dl; +} AstTreeCLibrary; + +typedef struct AstTreeCFunction { + AstTree *library; + AstTree *name; + AstTree *funcType; +} AstTreeCFunction; + #ifdef PRINT_COMPILE_TREE void astTreePrint(const AstTree *tree, int indent); void astTreeVariablePrint(const AstTreeVariable *variable, int indent); @@ -477,6 +496,10 @@ bool setTypesBuiltinBinaryWithRet(AstTree *tree, AstTreeSetTypesHelper helper, AstTree *retType); bool setTypesBuiltinPutc(AstTree *tree, AstTreeSetTypesHelper helper, AstTreeFunctionCall *functionCall); +bool setTypesBuiltinCLibrary(AstTree *tree, AstTreeSetTypesHelper helper, + AstTreeFunctionCall *functionCall); +bool setTypesBuiltinCFunction(AstTree *tree, AstTreeSetTypesHelper helper, + AstTreeFunctionCall *functionCall); bool setTypesTypeArray(AstTree *tree, AstTreeSetTypesHelper helper); bool setTypesArrayAccess(AstTree *tree, AstTreeSetTypesHelper helper); bool setTypesAstFunction(AstTreeFunction *function, |