rework: AST now uses an arena for allocation
For now it works but i dont really like that i use ParseResult, i mean is necessary but i think i will try to make it cleaner so that i can just directly use like parse and pass tath into evaluate, that would require to move the main evaluate funciton into evaluate_tree or something and evaluate takes the arena, uses evaluate_tree and frees the arena, will try that the next commit but for now this version works perfectly.
This commit is contained in:
@@ -16,7 +16,8 @@ static void test_basic_evaluation(void** state) {
|
||||
ASTNodeArray context;
|
||||
|
||||
tokenize(expr, &context);
|
||||
AST tree = parse(&context);
|
||||
ParseResult result = parse(&context);
|
||||
AST tree = result.tree;
|
||||
uint64_t value = evaluate(tree.head);
|
||||
|
||||
assert_int_equal(value, 82);
|
||||
|
||||
Reference in New Issue
Block a user