#ifndef TYCHE_VM_HH #define TYCHE_VM_HH #include "code.hh" #include "location.hh" #include "stack.hh" namespace tyche::vm { class VM { public: VM& load_bytecode(ByteArray const& ba); VM& call(size_t n_params); [[nodiscard]] int32_t to_integer(int index) const; VM& push_integer(int32_t value); [[nodiscard]] std::string debug_stack() const { return stack_.debug(); } private: void run_until_return(); void step(); static void assert_type(Value const& val, Type type); Stack stack_; Code code_; std::stack loc_; }; } // tyche #endif //TYCHE_VM_HH