Files
cval/include/ast_util.h
2025-11-23 22:07:04 +09:00

36 lines
699 B
C

#pragma once
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "globals.h"
void ast_node_add_child(ASTNode *parent, ASTNode *child);
void ast_node_free(ASTNode *node);
void ast_node_print(ASTNode *node, int depth);
/*
NODE SPECIFIC FUNCTIONS
*/
ASTNode *ast_node_program();
ASTNode *ast_node_defn(Token tok_val, ASTNode *type, ASTNode *id, ASTNode *expr);
ASTNode *ast_node_type_simple(Token tok_id);
ASTNode *ast_node_type_complex(Token tok_bracket, ASTNode *type_param, ASTNode *type_out);
ASTNode *ast_node_type_param();
ASTNode *ast_node_type_out();
ASTNode *ast_node_type_star(Token tok_star);
ASTNode *ast_node_type_void();
ASTNode *ast_node_id(Token id);