#if !defined(BOOST_SPIRIT_CALC7_VM_HPP)
#define BOOST_SPIRIT_CALC7_VM_HPP
#include <vector>
namespace client
{
enum byte_code
{
op_neg, op_add, op_sub, op_mul, op_div,
op_load, op_store, op_int, op_stk_adj };
class vmachine
{
public:
vmachine(unsigned stackSize = 4096)
: stack(stackSize)
, stack_ptr(stack.begin())
{
}
void execute(std::vector<int> const& code);
std::vector<int> const& get_stack() const { return stack; };
private:
std::vector<int> stack;
std::vector<int>::iterator stack_ptr;
};
}
#endif