diff options
| author | hachem <im@hachem.wtf> | 2026-09-19 18:53:06 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-19 18:53:06 +0200 |
| commit | c6aab10e74d58fbcad723c5f074a0bb51e9f2283 (patch) | |
| tree | 89d66cc61c99c4cc4b7824e3a3a2fabf3d5a674e /eval.h | |
| parent | cd2a86435e5e413630e0ab0caa48d900e49ea275 (diff) | |
feat: add functions with defines params and return
Diffstat (limited to 'eval.h')
| -rw-r--r-- | eval.h | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -6,6 +6,7 @@ #include <stdint.h> #define VARIABLES_MAX 64 +#define FUNCTIONS_MAX 32 // the longest thing a single type can say when emitted #define TEXT_LENGTH_MAX 255 @@ -23,7 +24,6 @@ enum TypeKind KIND_VALUE }; -// a tuple keeps what it will say, already said, so nothing inside it can go out of scope struct Type { enum TypeKind kind; @@ -38,15 +38,26 @@ struct Variable bool declared; }; +struct Function +{ + char name[NAME_LENGTH_MAX + 1]; + const struct Node* node; + bool defined; +}; + struct Machine { struct Variable variables[VARIABLES_MAX]; + struct Function functions[FUNCTIONS_MAX]; + struct Type returned; + int depth; }; enum RunStatus { RUN_DONE, - RUN_FAILED + RUN_FAILED, + RUN_RETURNED }; void machine_init(struct Machine* machine); |
