mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
a870bb53e4
* new method of inline-array-class * up to new array * wip side effect stuff * prepare for pop barrier stuff * add pop barrier * add local vars hack to compiler * fix bug, make sort work * add test for array * bug fixes * another bug fix * refactoring env variable print for casts * more tweaks * updates * final cleanup * codacy fixes
30 lines
847 B
C++
30 lines
847 B
C++
/*!
|
|
* 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 <string>
|
|
#include <unordered_map>
|
|
#include "Instruction.h"
|
|
#include "DecompilerLabel.h"
|
|
|
|
namespace decompiler {
|
|
struct ParsedProgram {
|
|
std::vector<DecompilerLabel> labels;
|
|
std::vector<Instruction> instructions;
|
|
std::string print();
|
|
};
|
|
|
|
class InstructionParser {
|
|
public:
|
|
InstructionParser();
|
|
Instruction parse_single_instruction(std::string str, const std::vector<DecompilerLabel>& labels);
|
|
ParsedProgram parse_program(const std::string& str,
|
|
const std::vector<std::string>& predefined_labels = {});
|
|
|
|
private:
|
|
std::unordered_map<std::string, int> m_opcode_name_lookup;
|
|
};
|
|
} // namespace decompiler
|