#ifndef sk_PROGRAM_HPP #define sk_PROGRAM_HPP #include "commons.hpp" #include "opcodes.hpp" namespace sk { struct Instr { OpcodeType opcode; std::optional param; }; class Value; class Program { public: explicit Program(); virtual ~Program(); std::string string() const; size_t size() const { return m_instrs.size(); } size_t value_size() const { return m_values.size(); } void push_instr(OpcodeType opcode, std::optional param = std::nullopt); Instr const& instr(size_t index) const; Instr& instr(size_t index); size_t push_value(std::shared_ptr value); std::shared_ptr value(size_t index); private: std::vector m_instrs; std::vector> m_values; }; } #endif