#ifndef INCLUDE_TCG_TRANSLATOR_H_ #define INCLUDE_TCG_TRANSLATOR_H_ #include "Public/Public.h" #include "Public/Scope.h" #include "Public/TAC.h" #include "TCG/ASM.h" #include "TCG/BlockTranslator.h" class Translator { private: BlockTranslator BlockTranslator_; std::shared_ptr Global_Scope; std::shared_ptr TACFile_; std::shared_ptr ASMFile_; // 翻译数据段 void dataTranslate(); // 翻译代码段 void textTranslate(); public: // 构造函数,接受输入 Translator(std::shared_ptr, std::shared_ptr); // 完成三地址到汇编的翻译 void Translate(); // 结果格式化输出到文件 void OutputFile(std::string); }; #endif // INCLUDE_TCG_TRANSLATOR_H_