Grafo da AST bem melhor. Loopando infinitamente ao montar tabela de simbolos.
[toypasc.git] / ast.h
blob03944215a20a5eb1baa318a7acce78ad7c8d5de5
1 #ifndef AST_H
2 #define AST_H
4 #include "base.h"
5 #include "parser.h"
6 #include "symbol_table.h"
8 struct AstNode {
9 char *name;
10 int kind;
11 Type type;
12 Value value;
13 Symbol *symbol;
14 int linenum;
15 struct AstNode* children;
16 struct AstNode* sibling;
19 struct AstNode *ast_node_new(const char* name, int kind, int type,
20 int linenum, Symbol *symbol);
21 void ast_node_destroy(struct AstNode *node);
23 void ast_node_add_child(struct AstNode *node, struct AstNode *child);
24 void ast_node_add_sibling(struct AstNode *node, struct AstNode *sibling);
26 Type ast_node_get_type(struct AstNode *node);
27 void ast_node_set_type(struct AstNode *node, Type type);
29 void ast_node_fill_symbol_table(struct AstNode *node, Symbol *symtab);
31 void ast_node_print(struct AstNode *node);
32 void ast_node_print_graph(struct AstNode *node, Symbol *sym_table);
34 #endif // AST_H