23 lines
689 B
C++
23 lines
689 B
C++
#ifndef INCLUDE_TCG_SENTENCETRANSLATOR_BASETRANSLATOR_H_
|
|
#define INCLUDE_TCG_SENTENCETRANSLATOR_BASETRANSLATOR_H_
|
|
|
|
#include "Public/Public.h"
|
|
#include "Public/TAC.h"
|
|
#include "TCG/SymbolManager.h"
|
|
#include "TCG/ASM.h"
|
|
|
|
class BaseTranslator {
|
|
public:
|
|
// 完成对语句的翻译
|
|
ASMLines SentenceTranslate(SymbolManager&, TACLine&);
|
|
virtual ASMLines SentenceTranslate_(SymbolManager&, TACLine&) = 0;
|
|
};
|
|
|
|
inline ASMLines BaseTranslator::SentenceTranslate(SymbolManager& SymbolManager_, TACLine& TACLine_) {
|
|
SymbolManager_.set_scope(TACLine_.scope);
|
|
return this->SentenceTranslate_(SymbolManager_, TACLine_);
|
|
}
|
|
|
|
|
|
#endif // INCLUDE_TCG_SENTENCETRANSLATOR_BASETRANSLATOR_H_
|