⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interpreter.h

📁 一个可视化的编译器
💻 H
字号:
/// <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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -