![]() |
Purple
0.1
Standard Language Specification
|
Logic for constructing an Abstract Syntax Tree (AST) More...

Functions | |
| ASTNode * | create_ast_node (TokenType ttype, ASTNode *left, ASTNode *mid, ASTNode *right, Type type, char *symbol_name) |
| Constructs a new AST Node with the provided values. More... | |
| void | add_position_info (ASTNode *dest, position p) |
| Add position information to an ASTNode. More... | |
| ASTNode * | create_ast_nonidentifier_leaf (TokenType ttype, Type type) |
| Constructs a new AST Leaf Node with the provided values for a token that is not an identifier. More... | |
| ASTNode * | create_ast_identifier_leaf (TokenType ttype, char *symbol_name) |
| Constructs a new AST Leaf Node with the provided values for a token that is an identifier. More... | |
| ASTNode * | create_unary_ast_node (TokenType ttype, ASTNode *child, Type type, char *symbol_name) |
| Constructs a new AST Unary Parent Node with the provided values. More... | |
| static int | ast_node_height (ASTNode *node) |
| Get the height of an AST Node. More... | |
| static void | ast_debug_current_level (ASTNode *root, int height, LogLevel log_level) |
| Print out a single level of an AST in order from left to right. More... | |
| void | ast_debug_level_order (ASTNode *root, LogLevel log_level) |
| Print out an AST's level order traversal. More... | |
| void | free_ast_node (ASTNode *root) |
Logic for constructing an Abstract Syntax Tree (AST)
Print out a single level of an AST in order from left to right.
| root | Root of AST |
| height | Level of tree to be printed out |
| log_level | Log level to print at |
Print out an AST's level order traversal.
| root | Root of AST |
| log_level | Log level to print at |
|
static |
Get the height of an AST Node.
| node | Node to get height of |
Constructs a new AST Leaf Node with the provided values for a token that is an identifier.
| ttype | TokenType of the new AST Node |
| symbol_name | The identifier for the provided Token information |
| ASTNode * create_ast_node | ( | TokenType | ttype, |
| ASTNode * | left, | ||
| ASTNode * | mid, | ||
| ASTNode * | right, | ||
| Type | type, | ||
| char * | symbol_name | ||
| ) |
Constructs a new AST Node with the provided values.
| ttype | TokenType of the new AST Node |
| left | Left child subtree of the new AST Node |
| mid | Middle child subtree of the new AST Node |
| right | Right child subtree of the new AST Node |
| type | Type of the new AST Node |
| symbol_name | The identifier for the provided Token information |
Constructs a new AST Leaf Node with the provided values for a token that is not an identifier.
| ttype | TokenType of the new AST Node |
| type | Type of the new AST Node |
Constructs a new AST Unary Parent Node with the provided values.
| ttype | TokenType of the new AST Node |
| child | The AST Node's single child |
| type | Type of the new AST Node |
| symbol_name | The identifier for the provided Token information |
| void free_ast_node | ( | ASTNode * | root | ) |