+enum eval_state {
+ eval_sexpr, /* Evaluate an sexpr */
+ eval_val,
+ eval_formal,
+ eval_exec,
+ eval_cond,
+ eval_cond_test
+};
+
+struct ao_lisp_stack {
+ uint8_t state; /* enum eval_state */
+ ao_poly prev; /* previous stack frame */
+ ao_poly sexprs; /* expressions to evaluate */
+ ao_poly values; /* values computed */
+ ao_poly values_tail; /* end of the values list for easy appending */
+ ao_poly frame; /* current lookup frame */
+ ao_poly list; /* most recent function call */
+};
+
+static inline struct ao_lisp_stack *
+ao_lisp_poly_stack(ao_poly p)
+{
+ return ao_lisp_ref(p);
+}
+
+static inline ao_poly
+ao_lisp_stack_poly(struct ao_lisp_stack *stack)
+{
+ return ao_lisp_poly(stack, AO_LISP_OTHER);
+}
+
+extern struct ao_lisp_stack *ao_lisp_stack;
+extern ao_poly ao_lisp_v;
+
+#define AO_LISP_FUNC_LAMBDA 0
+#define AO_LISP_FUNC_NLAMBDA 1
+#define AO_LISP_FUNC_MACRO 2
+#define AO_LISP_FUNC_LEXPR 3