lang: ast: implement parsing of atoms

This commit is contained in:
2024-12-06 13:46:41 +00:00
parent 7ba0a05332
commit 2bd3e96427
4 changed files with 29 additions and 0 deletions

18
lang/ast/atom.c Normal file
View File

@@ -0,0 +1,18 @@
#include "ctx.h"
#include "node.h"
#include <stdio.h>
static void print(struct ivy_ast_node *node)
{
struct ivy_ast_atom_node *v = (struct ivy_ast_atom_node *)node;
printf("%s (%s)\n", ivy_ast_node_type_to_string(node->n_type),
v->n_content->t_str);
}
struct ast_node_type atom_node_ops = {
.n_print = print,
.n_state_size = sizeof(struct parser_state),
.n_node_size = sizeof(struct ivy_ast_atom_node),
};