aboutsummaryrefslogtreecommitdiffstats
path: root/include/parser.h
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-01-23 08:23:46 -0500
committerClyne Sullivan <tullivan99@gmail.com>2018-01-23 08:23:46 -0500
commitbf230d6a745e61d72cd364bc6f0bea282671b634 (patch)
tree5aa04d7efa663a25c0ba7fe97d464de8feb05569 /include/parser.h
parenta93e506b78b7379e14c23ae80a5281485897faee (diff)
interpreter integration
Diffstat (limited to 'include/parser.h')
-rw-r--r--include/parser.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/parser.h b/include/parser.h
new file mode 100644
index 0000000..c6a2b17
--- /dev/null
+++ b/include/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_