diff options
Diffstat (limited to 'src/ast.h')
-rw-r--r-- | src/ast.h | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -23,7 +23,8 @@ typedef enum { TYPE_I32, - TYPE_BOOL + TYPE_BOOL, + TYPE_VOID, } type_t; typedef struct ast_node_t ast_node_t; @@ -124,8 +125,12 @@ typedef struct ast_node_t { ast_node_kind_t kind; ast_node_data_t data; + type_t result_type; } ast_node_t; +char * +ast_type_to_str(type_t type); + ast_node_t * ast_node_new(void); @@ -136,7 +141,10 @@ void ast_node_destroy(ast_node_t *node); ast_node_t * -ast_node_new_binary_operation(ast_binary_operation_kind_t kind, ast_node_t *left, ast_node_t *right); +ast_node_new_binary_operation(ast_binary_operation_kind_t kind, + ast_node_t *left, + ast_node_t *right, + type_t result_type); ast_node_t * ast_node_new_function_declaration(string_view_t function_name, type_t return_type, vector_t *body); @@ -154,7 +162,7 @@ ast_node_t * ast_node_new_literal_bool(bool boolean); ast_node_t * -ast_node_new_variable(ast_identifier_t *identifier); +ast_node_new_variable(ast_identifier_t *identifier, type_t result_type); ast_node_t * ast_node_new_variable_assignment(ast_identifier_t *identifier, ast_node_t *expression); |