aboutsummaryrefslogtreecommitdiffstats
path: root/parser.h
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-01-23 08:17:07 -0500
committerClyne Sullivan <tullivan99@gmail.com>2018-01-23 08:17:07 -0500
commit548804f4b49a06aa9033bea2dd292f8a12997b82 (patch)
tree4ac7dbbcf53120766cf0bf3edb47399fa7f56e94 /parser.h
initial commit
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/parser.h b/parser.h
new file mode 100644
index 0000000..c6a2b17
--- /dev/null
+++ b/parser.h
@@ -0,0 +1,31 @@
+#ifndef PARSER_H_
+#define PARSER_H_
+
+#include <variable.h>
+
+typedef void *stack_t;
+
+typedef struct {
+ uint16_t status;
+ uint16_t vcount;
+ variable *vars;
+ char **names;
+ stack_t *stack;
+} interpreter;
+
+enum status {
+ READY = 0
+};
+
+typedef void (*func_t)(stack_t *);
+
+void interpreter_init(interpreter *);
+
+void interpreter_define_value(interpreter *, const char *, int32_t);
+void interpreter_define_cfunc(interpreter *, const char *, func_t);
+
+int32_t interpreter_get_value(interpreter *, const char *);
+
+int interpreter_doline(interpreter *, const char *);
+
+#endif // PARSER_H_