beginnings of REPL
[muddle-interpreter.git] / src / eval.h
diff --git a/src/eval.h b/src/eval.h
new file mode 100644 (file)
index 0000000..22b5374
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+Copyright (C) 2017 Keziah Wesley
+
+You can redistribute and/or modify this file under the terms of the
+GNU Affero General Public License as published by the Free Software
+Foundation, either version 3 of the License, or (at your option) any
+later version.
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this file. If not, see
+<http://www.gnu.org/licenses/>.
+*/
+
+#ifndef EVAL_H
+#define EVAL_H
+
+#include "object.h"
+
+void eval ();
+void push_frame (void (*fn) (), tuple_object args, void (*cont) ());
+
+// stack:
+// <0> args...
+// <0> frametop
+// <0> framebottom
+// <0> temps...
+// <1> args...
+// <1> frametop
+typedef struct frame frame;
+struct frame
+{
+  // <0> frametop (set for this call)
+  subr_object cont;
+  tuple_object args;
+  tuple_object prevframe;
+  // <0> framebottom (state saved before child call)
+
+  // <0> temps, <1> args
+  object locals[];
+};
+
+#endif // EVAL_H