lang: ast: convert RPN expression queue to ast and replace generic EXPR node with it

This commit is contained in:
2024-11-28 22:06:25 +00:00
parent 05ced5d5fc
commit ec24e2c327
8 changed files with 212 additions and 58 deletions

View File

@@ -146,18 +146,21 @@ token_parse_function get_token_parser(
return better_parser ? better_parser : generic_parser;
}
struct ivy_ast_node *ast_node_create_with_size(
enum ivy_ast_node_type type, size_t size)
struct ivy_ast_node *ast_node_create(enum ivy_ast_node_type type)
{
struct ivy_ast_node *node = malloc(size);
const struct ast_node_type *type_info = get_ast_node_type(type);
if (!type_info) {
return NULL;
}
struct ivy_ast_node *node = malloc(type_info->n_node_size);
if (!node) {
return NULL;
}
memset(node, 0x0, size);
memset(node, 0x0, type_info->n_node_size);
node->n_type = type;
return node;
}