minor implementation for parser
(simple type and defn)
This commit is contained in:
36
include/ast_util.h
Normal file
36
include/ast_util.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#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);
|
||||
Reference in New Issue
Block a user