diff options
author | Carlos Maniero <carlos@maniero.me> | 2023-05-10 16:53:05 -0300 |
---|---|---|
committer | Carlos Maniero <carlos@maniero.me> | 2023-05-10 19:23:52 -0300 |
commit | 3129b741064c2b4f2c6c2408bd42cc83f7341ea8 (patch) | |
tree | ec499cf238b266f963f8b6524b4b96190ccac9bf /src/ast.h | |
parent | 75639fbf01bd6ae1212521b6cf822025eb8b598d (diff) |
gas: Generate function call
This is an initial commit that enables function calls. At this point
only functions with no parameters is going to work.
Signed-off-by: Carlos Maniero <carlos@maniero.me>
Diffstat (limited to 'src/ast.h')
-rw-r--r-- | src/ast.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -54,6 +54,11 @@ typedef struct ast_variable_t ast_identifier_t *identifier; } ast_variable_t; +typedef struct ast_function_call_t +{ + ast_identifier_t *identifier; +} ast_function_call_t; + typedef struct ast_function_declaration_t { ast_identifier_t identifier; @@ -128,6 +133,7 @@ typedef enum AST_BINARY_OPERATION, AST_BLOCK, AST_FUNCTION_DECLARATION, + AST_FUNCTION_CALL, AST_LITERAL, AST_RETURN_STMT, AST_IF_STMT, @@ -142,6 +148,7 @@ typedef union ast_namespace_t ns; ast_binary_operation_t binary_operation; ast_function_declaration_t function; + ast_function_call_t function_call; ast_literal_t literal; ast_block_t block; ast_if_stmt_t if_stmt; @@ -183,6 +190,9 @@ ast_node_t * ast_node_new_function_declaration(string_view_t function_name, type_t return_type, ast_node_t *body); ast_node_t * +ast_node_new_function_call(ast_identifier_t *identifier, type_t result_type); + +ast_node_t * ast_node_new_return_stmt(ast_node_t *argument); ast_node_t * @@ -212,4 +222,10 @@ ast_node_ns_get_function_node_by_sv(ast_node_t *ns, string_view_t name); ast_node_t * ast_node_ns_get_function_node_by_name(ast_node_t *ns, char *function_name); +bool +ast_node_is_variable_declaration(ast_node_t *node); + +bool +ast_node_is_function_declaration(ast_node_t *node); + #endif /* AST_H */ |