11 log(std::format(
"VM::{}({:T})\n", __func__, value));
21 log(std::format(
"VM::{}({})\n", __func__, index));
33 log(std::format(
"VM::{}(\"{}\")\n", __func__, name));
37 throw std::runtime_error(
"Error in freeVariable(): No bytecode loaded");
40 throw std::runtime_error(
"Error in freeVariable(): Unknown variable \"" + name +
"\"");
48 log(std::format(
"VM::{}({}, {:T})\n", __func__, index, value));
53 throw std::runtime_error(
"Invalid variable index");
63 log(std::format(
"VM::{}({}) -> <invalid index>\n", __func__, index));
66 throw std::runtime_error(
"Invalid variable index");
69 log(std::format(
"VM::{}({}) -> {:T}\n", __func__, index,
variables[index]));
78 log(std::format(
"VM::{}()\n", __func__));
std::vector< Value > variables
Variable storage indexed by variable index, or simply: the managed heap.
Value getVariable(size_t index)
Get a variable from the VM.
void freeVariableByName(const std::string &name)
Free a variable by name in the VM.
size_t getVariableCount()
Get the number of variables in the VM.
void log(const Value &msg)
Log a Value to stdout.
size_t addVariable(const Value &value)
Add a variable to the VM.
void flush()
Flush stdout.
void setVariable(size_t index, const Value &value)
Set a variable in the VM.
const Bytecode * m_bytecode
Bytecode to execute.
void freeVariable(size_t index)
Free a variable in the VM.
A value in the Phasor VM.
The Phasor Programming Language and Runtime.