diff options
| author | hachem <im@hachem.wtf> | 2026-09-19 14:38:55 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-19 14:38:55 +0200 |
| commit | b79902cd36b2c5b54bbf0f07078fc528754977b2 (patch) | |
| tree | 0f3baa55b58831c46c7631619f76eef5cb371f71 /eval.h | |
| parent | 7160bdb390ef1c9bdcfb0c075b33be39d62860f3 (diff) | |
feat: variables and shi
Diffstat (limited to 'eval.h')
| -rw-r--r-- | eval.h | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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); |
