From b79902cd36b2c5b54bbf0f07078fc528754977b2 Mon Sep 17 00:00:00 2001 From: hachem Date: Sat, 19 Sep 2026 14:38:55 +0200 Subject: feat: variables and shi --- eval.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'eval.h') 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 #include +#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); -- cgit v1.3