/*! * The InstructionParser converts a string like "daddu a0, s7, r0" into an Instruction. * It is used to generate test sequences of instructions for decompiler algorithms. */ #pragma once #include #include #include "Instruction.h" #include "DecompilerLabel.h" namespace decompiler { struct ParsedProgram { std::vector labels; std::vector instructions; std::string print(); }; class InstructionParser { public: InstructionParser(); Instruction parse_single_instruction(std::string str, const std::vector& labels); ParsedProgram parse_program(const std::string& str, const std::vector& predefined_labels = {}); private: std::unordered_map m_opcode_name_lookup; }; } // namespace decompiler