diff options
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); |
