From d86d70fc7c6751713a6b9f02d9f77814e2f75718 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Fri, 21 Apr 2023 15:11:17 +0200 Subject: 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 Reviewed-by: Carlos Maniero --- src/ast.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ast.c') 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"); } -- cgit v1.2.3