74 os <<
"<" << val.
type <<
": ";
75 if (
"string" == val.
type) {
77 os << *static_cast<const std::string*>(val.
get_ptr());
88 using VMStorage = std::unordered_map<std::string, VMValue>;
97 std::stack<VMValue> exec_stack;
111 void exec_cmd(
const std::vector<VMValue>& exec_vec);
122 using std::runtime_error::runtime_error;
Parsed data (single section)
void exec_cmd(const std::vector< VMValue > &exec_vec)
void execute_line(const Parser::BodyLine &line)
Executes one line of code.
VMValue()
default constructor
std::vector< std::string > BodyLine
std::string type
name of the type
The virtual machine executing VATA code.
VMValue(const VMValue &rhs)
copy constructor
const void * VMPointer
Data type representing a pointer to a memory holding a value.
std::unordered_map< std::string, VMValue > VMStorage
A dictionary mapping names to values.
VMValue(const std::string &type, VMPointer ptr)
standard constructor
void process_token(const std::string &tok)
std::vector< ParsedSection > Parsed
Parsed data.
VirtualMachine()
default constructor
void run(const Vata2::Parser::Parsed &parsed)
VMValue & operator=(const VMValue &rhs)
assignment operator
Data type representing a value, which is composed of a type and a pointer to a general memory...
The exception for virtual machine errors.
void clean_stack()
Cleans the stack.
friend std::ostream & operator<<(std::ostream &os, const VMValue &val)
conversion to string
void run_code(const Vata2::Parser::ParsedSection &parsec)
VMPointer get_ptr() const
returns the included pointer