hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/eval.h
diff options
context:
space:
mode:
Diffstat (limited to 'eval.h')
-rw-r--r--eval.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/eval.h b/eval.h
index c2365cc..924ad92 100644
--- a/eval.h
+++ b/eval.h
@@ -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);