refactor: evaluator separated into evaluate bin and un

Is nicer this way, also made it more beautiful to look at and therefor
to understand.
This commit is contained in:
2026-05-13 18:06:01 -06:00
parent b56a368244
commit 3ec73559ee
3 changed files with 85 additions and 72 deletions

View File

@@ -1,7 +1,6 @@
#ifndef EVALUATOR_H
#define EVALUATOR_H
#include "lexer.h"
#include "parser.h"
#include <stdint.h>
@@ -20,6 +19,9 @@ typedef struct {
};
} EvaluatorResult;
EvaluatorResult evaluate_binary(Node *tree);
EvaluatorResult evaluate_unary(Node *tree);
EvaluatorResult evaluate(ParserResult context);
EvaluatorResult evaluate_tree(Node *tree);

View File

@@ -11,7 +11,6 @@ typedef enum {
NODE_INT,
NODE_BINARY_OP,
NODE_UNARY_OP,
NODE_PARENTHESIS,
} NodeType;
typedef struct Node {