-
Notifications
You must be signed in to change notification settings - Fork 3
/
vmachine.hpp
35 lines (26 loc) · 864 Bytes
/
vmachine.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*=============================================================================
Copyright (c) 2001-2009 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef VMACHINE_HPP_
#define VMACHINE_HPP_
#include <vector>
//!
//! The virtual machine...
//!
class vmachine
{
public:
vmachine(unsigned stackSize = 4096)
: stack(stackSize)
{
}
int execute(
std::vector<int> const& code // the program code
, std::vector<int>::const_iterator pc // program counter
, std::vector<int>::iterator frame_ptr // start of arguments and locals
);
std::vector<int> stack;
};
#endif /* VMACHINE_HPP_ */