beginnings of REPL
[muddle-interpreter.git] / src / eval.h
1 /*
2 Copyright (C) 2017 Keziah Wesley
3
4 You can redistribute and/or modify this file under the terms of the
5 GNU Affero General Public License as published by the Free Software
6 Foundation, either version 3 of the License, or (at your option) any
7 later version.
8
9 This file is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Affero General Public License for more details.
13
14 You should have received a copy of the GNU Affero General Public
15 License along with this file. If not, see
16 <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef EVAL_H
20 #define EVAL_H
21
22 #include "object.h"
23
24 void eval ();
25 void push_frame (void (*fn) (), tuple_object args, void (*cont) ());
26
27 // stack:
28 // <0> args...
29 // <0> frametop
30 // <0> framebottom
31 // <0> temps...
32 // <1> args...
33 // <1> frametop
34 typedef struct frame frame;
35 struct frame
36 {
37   // <0> frametop (set for this call)
38   subr_object cont;
39   tuple_object args;
40   tuple_object prevframe;
41   // <0> framebottom (state saved before child call)
42
43   // <0> temps, <1> args
44   object locals[];
45 };
46
47 #endif // EVAL_H