Compile to bytecode
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#include <configuration.hpp>
|
||||
#include <execute/flags.hpp>
|
||||
#include <execute/registers.hpp>
|
||||
#include <array>
|
||||
#include <execute/argumentvalue.hpp>
|
||||
#include <execute/bytecode.hpp>
|
||||
#include <execute/state.hpp>
|
||||
#include <interpret/code.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace Execute
|
||||
@@ -10,27 +9,39 @@ namespace Execute
|
||||
class VirtualMachine
|
||||
{
|
||||
private:
|
||||
Flags flags;
|
||||
Registers registers;
|
||||
State state;
|
||||
|
||||
std::unique_ptr<Interpret::Code const> codePtr;
|
||||
void DoArithmatic(
|
||||
InstructionByte const instruction,
|
||||
std::array<ArgumentValue, 3> & arguments);
|
||||
void SetInteger(std::array<ArgumentValue, 3> & arguments);
|
||||
void ExecuteJump(std::array<ArgumentValue, 3> & arguments);
|
||||
void ExecuteInterrupt(std::array<ArgumentValue, 3> & arguments);
|
||||
void ExecuteCall(
|
||||
std::array<ArgumentValue, 3> & arguments,
|
||||
std::size_t const returnByte);
|
||||
void ExecuteReturn();
|
||||
void DoBooleanLogic(
|
||||
InstructionByte const instruction,
|
||||
std::array<ArgumentValue, 3> & arguments,
|
||||
std::size_t const nextInstruction);
|
||||
void ExecutePop(std::array<ArgumentValue, 3> & arguments);
|
||||
void ExecutePush(std::array<ArgumentValue, 3> & arguments);
|
||||
|
||||
void Step();
|
||||
|
||||
public:
|
||||
void Run();
|
||||
void SingleStep();
|
||||
void LoadConfiguration(Configuration const & c);
|
||||
void LoadCode(std::unique_ptr<Interpret::Code> code);
|
||||
|
||||
Flags const & GetFlags() const;
|
||||
Registers const & GetRegisters() const;
|
||||
void SetMemorySize(std::size_t const size);
|
||||
void LoadCode(
|
||||
std::vector<std::uint8_t> const & byteCode,
|
||||
bool const printDecodedBytes);
|
||||
|
||||
State const & GetState() const;
|
||||
Interpret::Statement const * const GetCurrentStatement() const;
|
||||
Execute::InstructionByte GetCurrentInstruction() const;
|
||||
|
||||
bool IsTerminated() const;
|
||||
|
||||
VirtualMachine();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user