refactor: changes and additions ot parser

This commit is contained in:
2026-05-12 18:15:36 -06:00
parent c41847e120
commit 59f99059bb
5 changed files with 57 additions and 11 deletions

View File

@@ -3,6 +3,7 @@
#include "lexer.h"
#include "parser.h"
#include <stdint.h>
#include <math.h>
int64_t evaluate_tree(ASTNode *tree) {
@@ -20,7 +21,8 @@ int64_t evaluate_tree(ASTNode *tree) {
return evaluate_tree(left) * evaluate_tree(right);
case OP_DIV:
return evaluate_tree(left) / evaluate_tree(right);
case OP_POW:
return pow(evaluate_tree(left), evaluate_tree(right));
}
}