11 log(std::format(
"VM::{}({:T})\n", __func__, value));
14 stack.push_back(value);
22 log(std::format(
"VM::{}() -> <empty stack>\n", __func__));
25 std::string msg =
"Stack underflow at pc=" + std::to_string(
pc);
26 throw std::runtime_error(msg);
30 log(std::format(
"VM::{}() -> {:T}\n", __func__,
stack.back()));
43 log(std::format(
"VM::{}() -> <empty stack>\n", __func__));
46 std::string msg =
"Stack is empty at pc=" + std::to_string(
pc);
47 throw std::runtime_error(msg);
51 log(std::format(
"VM::{}() -> {:T}\n", __func__,
stack.back()));
Value pop()
Pop a value from the stack.
std::vector< Value > stack
Stack for function calls.
void log(const Value &msg)
Log a Value to stdout.
void flush()
Flush stdout.
size_t pc
Program counter.
void push(const Value &value)
Push a value onto the stack.
Value peek()
Peek at the top value on the stack.
A value in the Phasor VM.
The Phasor Programming Language and Runtime.