aboutsummaryrefslogtreecommitdiff
path: root/include/eval.h
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-01-20 02:34:32 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-01-20 02:34:32 +0300
commitc0cd4e5f199e8567ec3b5e216fbee27837d21bea (patch)
treec78eee02932fc6e85413e367d27ec5b5627e1534 /include/eval.h
downloadcmonkey-c0cd4e5f199e8567ec3b5e216fbee27837d21bea.tar.gz
cmonkey-c0cd4e5f199e8567ec3b5e216fbee27837d21bea.zip
init
Diffstat (limited to 'include/eval.h')
-rw-r--r--include/eval.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/eval.h b/include/eval.h
new file mode 100644
index 0000000..5f19271
--- /dev/null
+++ b/include/eval.h
@@ -0,0 +1,20 @@
+#ifndef CMONKEY_EVAL_H
+#define CMONKEY_EVAL_H
+
+#include "ast.h"
+#include "parser.h"
+#include "object.h"
+
+struct object *eval_program(struct environment *, struct program *);
+
+struct object *eval_statement(struct environment *, struct statement *);
+
+struct object *eval_expression(struct environment *, struct expression *);
+
+#define eval(e, n) _Generic((n), \
+ struct program *: eval_program, \
+ struct statement *: eval_statement, \
+ struct expression *: eval_expression \
+ )(e, n)
+
+#endif