summaryrefslogtreecommitdiff
path: root/src/ast.c
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2023-04-21 15:11:17 +0200
committerCarlos Maniero <carlosmaniero@gmail.com>2023-04-21 10:29:41 -0300
commitd86d70fc7c6751713a6b9f02d9f77814e2f75718 (patch)
tree15340e4f421628fa79461374c39407997f928d93 /src/ast.c
parent562fa8785f9bc3074e8b2acf524f4120add22752 (diff)
parser: Parse integers arithmetic expression
This patch implements the AST creation for arithmetic expressions. NOTE: The implementation works only for integer numbers. Signed-off-by: Johnny Richard <johnny@johnnyrichard.com> Reviewed-by: Carlos Maniero <carlosmaniero@gmail.com>
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ast.c b/src/ast.c
index 7f3af9e..5c94d68 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -64,12 +64,16 @@ ast_node_destroy(ast_node_t *node)
case AST_FUNCTION_DECLARATION:
ast_node_destroy(node->data.function.body);
break;
+ case AST_BINARY_OPERATION:
+ ast_node_destroy(node->data.binary_operation.left);
+ ast_node_destroy(node->data.binary_operation.right);
+ break;
+ case AST_LITERAL:
+ break;
case AST_RETURN_STMT:
break;
case AST_UNKOWN_NODE:
break;
- case AST_LITERAL:
- break;
default:
assert(false && "unmapped free strategy");
}