hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/eval.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-19 14:38:55 +0200
committerhachem <im@hachem.wtf>2026-09-19 14:38:55 +0200
commitb79902cd36b2c5b54bbf0f07078fc528754977b2 (patch)
tree0f3baa55b58831c46c7631619f76eef5cb371f71 /eval.h
parent7160bdb390ef1c9bdcfb0c075b33be39d62860f3 (diff)
feat: variables and shi
Diffstat (limited to 'eval.h')
-rw-r--r--eval.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/eval.h b/eval.h
index 649f5e9..eba8244 100644
--- a/eval.h
+++ b/eval.h
@@ -2,8 +2,11 @@
#include "ast.h"
+#include <stdbool.h>
#include <stdint.h>
+#define VARIABLES_MAX 64
+
enum TypeKind
{
KIND_VOID,
@@ -20,10 +23,23 @@ struct Type
int64_t number;
};
+struct Variable
+{
+ char name[NAME_LENGTH_MAX + 1];
+ int64_t value;
+ bool declared;
+};
+
+struct Machine
+{
+ struct Variable variables[VARIABLES_MAX];
+};
+
enum RunStatus
{
RUN_DONE,
RUN_FAILED
};
-enum RunStatus execute(const struct Node* statement);
+void machine_init(struct Machine* machine);
+enum RunStatus execute(struct Machine* machine, const struct Node* statement);