6#define IS_EXPR(node) ((node)->type >= AST_EXPR_LITERAL && (node)->type <= AST_EXPR_GROUPING)
7#define IS_STMT(node) ((node)->type >= AST_STMT_EXPRESSION && (node)->type <= AST_STMT_STRUCT)
8#define IS_TYPE(node) ((node)->type >= AST_TYPE_BASIC && (node)->type <= AST_TYPE_ENUM)
10#define IS_PROGRAM(node) ((node)->type == AST_PROGRAM)
11#define IS_EXPR_STMT(node) ((node)->type == AST_STMT_EXPRESSION)
12#define IS_LITERAL(node) ((node)->type == AST_EXPR_LITERAL)
13#define IS_BINARY(node) ((node)->type == AST_EXPR_BINARY)
14#define IS_GROUPING(node) ((node)->type == AST_EXPR_GROUPING)
15#define IS_UNARY(node) ((node)->type == AST_EXPR_UNARY)
16#define IS_CALL(node) ((node)->type == AST_EXPR_CALL)
17#define IS_VAR_DECL(node) ((node)->type == AST_STMT_VAR_DECL)
18#define IS_FUNC_DECL(node) ((node)->type == AST_STMT_FUNCTION)
19#define IS_BLOCK(node) ((node)->type == AST_STMT_BLOCK)
20#define IS_IF(node) ((node)->type == AST_STMT_IF)
21#define IS_LOOP(node) ((node)->type == AST_STMT_LOOP)
22#define IS_RETURN(node) ((node)->type == AST_STMT_RETURN)
30void print_ast(
const AstNode *node,
const char *prefix,
bool is_last,
bool root);
Abstract Syntax Tree definitions with documentation comment support.
LiteralType
Definition ast.h:85
BinaryOp
Definition ast.h:97
UnaryOp
Definition ast.h:121
NodeType
Definition ast.h:18
void print_prefix(const char *prefix, bool is_last)
Definition ast_utils.c:201
const char * literal_type_to_string(LiteralType type)
Definition ast_utils.c:182
const char * node_type_to_string(NodeType type)
Definition ast_utils.c:13
void print_ast(const AstNode *node, const char *prefix, bool is_last, bool root)
Definition ast_utils.c:219
const char * unop_to_string(UnaryOp op)
Definition ast_utils.c:155
const char * binop_to_string(BinaryOp op)
Definition ast_utils.c:108