interpreter.h
来自「一个可视化的编译器」· C头文件 代码 · 共 81 行
H
81 行
/// <author> 任晶磊 </author>
/// <update> 2008-3-1 </update>
/// <E-mail> renjinglei@163.com </E-mail>
#ifndef INTERPRETER_H
#define INTERPRETER_H
#include "Stack.h"
#include "Lexer.h"
#include "Parser.h"
#include "Error.h"
#include <string>
namespace C0
{
namespace Interpreter
{
using FileAdapter::File;
using C0::Lexer::Lexer;
using C0::Parser::Parser;
class Interpreter
{
bool isToExecute;
bool isSourcePrint;
bool isTokensPrint;
std::string fileName;
Lexer lexer;
Parser parser;
Context context;
ErrorLog errorLog;
public:
Interpreter():isToExecute(true), isSourcePrint(false), isTokensPrint(false)
{
lexer.SetErrorLog(&errorLog);
parser.SetErrorLog(&errorLog);
int* a = new int(1);
}
Interpreter(string fn):isToExecute(true), isSourcePrint(false), isTokensPrint(false)
{
fileName = fn;
lexer.SetErrorLog(&errorLog);
parser.SetErrorLog(&errorLog);
}
void Open(string fn)
{
fileName = fn;
}
void SetNotToExecute()
{
isToExecute = false;
}
void SetSourcePrint()
{
isSourcePrint = true;
}
void SetTokensPrint()
{
isTokensPrint = true;
}
void Interprete();
void Interprete(string fn)
{
fileName = fn;
Interprete();
}
private:
void PrintSource(){}
};
}
}
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?