private:
// stack for operands
using stack_t = mem::vector<item>;
stack_t theStack;
void draw(ostream& out);
// The initializer functions for imports, indexed by name.
importInitMap *initMap;
// The stack stores a map of initialized imported modules by name, so that
// each module is initialized only once and each import refers to the same
// instance.
using importInstanceMap = mem::map<const mem::string, vmFrame*>;
importInstanceMap instMap;
// One can associate an environment to embedded code while running.
trans::coenv *e;
// Debugger variables:
char debugOp;
position lastPos, breakPos;
bool newline;
// Move arguments from stack to frame.
void marshall(size_t args, stack::vars_t vars);
// Runs a lambda. If vars is non-null, it is used to store the variables of
// the lambda. Otherwise, the method allocates a closure only if needed.
void runWithOrWithoutClosure(lambda *l, vars_t vars, vars_t parent);
// Executes a function on top of the stack.
void run(func *f);
// Put an import (indexed by filename and optional template
// parameter signature) on top of the stack, initializing it if necessary.
void loadModule(string index, Int numPushedParents = 0);
// These are so that built-in functions can easily manipulate the stack
void push(item next) {
theStack.push_back(next);
}
template <typename T>
void push(T next) {
push((item)next);
}
item top() {
return theStack.back();
}
item pop() {
item ret = theStack.back();
theStack.pop_back();
return ret;
}
template <typename T>
T pop()
{
return get<T>(pop());
}
};