lang: ast: define ast_node_type for some fundamental expression components

This commit is contained in:
2024-11-28 22:05:37 +00:00
parent 47c11e4c10
commit 05ced5d5fc
7 changed files with 123 additions and 0 deletions

14
lang/ast/double.c Normal file
View File

@@ -0,0 +1,14 @@
#include "ctx.h"
#include "node.h"
static void print(struct ivy_ast_node *node)
{
struct ivy_ast_double_node *v = (struct ivy_ast_double_node *)node;
printf("%s (%.2lf)\n", ivy_ast_node_type_to_string(node->n_type), v->n_value->t_double);
}
struct ast_node_type double_node_ops = {
.n_state_size = sizeof(struct parser_state),
.n_node_size = sizeof(struct ivy_ast_double_node),
};