10 std::vector<std::string>
keywords{
"program",
"object",
"module",
"data",
"code",
"section"};
15 size_t i =
static_cast<size_t>(key);
24 size_t pos =
static_cast<size_t>(i);
34 std::ostringstream opc;
35 if (!inc.
op1.
op.empty())
36 opc <<
" " << inc.
op1.
op;
37 if (!inc.
op2.
op.empty())
38 opc <<
", " << inc.
op2.
op;
39 if (!inc.
op3.
op.empty())
40 opc <<
", " << inc.
op3.
op;
41 for (
const auto &arg : inc.
vop) {
43 opc <<
", " << arg.op;
45 if (opc.str().length() > 0) {
46 out << opc.str() <<
"]";
85 std::ostringstream stream;
91 std::ostringstream stream;
int64_t pos(const char *substr, const char *s)
std::ostream & operator<<(std::ostream &out, const mxvm::Keywords &key)
Stream insertion operator for Keywords.
Instruction set enum, operand/instruction structs, variable types, and Variable/Variable_Value defini...
std::vector< std::string > IncType
String representations of Inc opcodes, indexed by enum value.
Inc
MXVM instruction set opcodes.
Keywords
MXVM language keywords.
VarType
MXVM variable type discriminator.
std::vector< std::string > keywords
String representations of Keywords enum values.
A complete MXVM instruction with opcode, operands, and optional label.
std::string toString() const
Convert this instruction to its assembly text representation.
std::vector< Operand > vop
variable-length operand list (for print, invoke, etc.)
Inc instruction
the opcode
Operand op3
up to three fixed operands
std::string op
textual operand value
std::string toString() const
Convert this variable to a human-readable string.