7318c9d7d377609777a1baa5f2b0118312f942c6
[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 /* TODO: don't expose this in header */
28 // stack:
29 // <0> args...
30 // <0> frametop
31 // <0> framebottom
32 // <0> temps...
33 // <1> args...
34 // <1> frametop
35 typedef struct frame frame;
36 struct frame
37 {
38   // <0> frametop (set for this call)
39   subr_object cont;
40   tuple_object args;
41   tuple_object prevframe;
42   // <0> framebottom (state saved before child call)
43   object *prevcst;
44
45   // <0> temps, <1> args
46   object locals[];
47 };
48
49 #endif // EVAL_H