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

📄 cifafenxi.h

📁 一个很不错的可视化词法分析器 用C++写的
💻 H
字号:
// Compiler.h: interface for the CCompiler class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_COMPILER_H__0B392D63_565E_4D11_8668_F37CDF11364E__INCLUDED_)
#define AFX_COMPILER_H__0B392D63_565E_4D11_8668_F37CDF11364E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define QUAD_OPCODE_TABLE_LEN 30
#define SOURSE_BUFFER_LEN 30003
#define MAX_LEX_LEN 20
#define ERROR_MESSAGE_LEN 100
#define LEX_DUAD_TABLE_LEN 10000
#define ERROR_TABLE_LEN 100
#define MAX_NUMBER_LEN 8
#define KEY_WORD_TABLE_LEN 50
#define QUAD_OPCODE_LEN 10

struct CifaResult
{
	int type;//0:error,1:id,2:num,3-:keyword and operator,-1:end note
	int value;//二元式中value值
	char text[MAX_LEX_LEN];//单词
	int address;//源文件缓冲区中地址
};

typedef char (* USER_TYPE_cha100)[ERROR_MESSAGE_LEN];
struct InterfaceType
{
	CifaResult * * LexicalDuad;//词法分析二元式
	char * SourseBuffer;//源程序缓冲区
	USER_TYPE_cha100 ErrorMessageTable;//出错信息表
};

class CCompiler  
{
public:
	InterfaceType * GetTable();
	void CiFaFengXi();
	CCompiler();
	virtual ~CCompiler();
protected:
	int m_ntCifaLen;
	char m_aSourse[SOURSE_BUFFER_LEN];
	InterfaceType m_Interface;
	char m_QuadOpCodeTable[QUAD_OPCODE_TABLE_LEN][QUAD_OPCODE_LEN];
	CifaResult * m_tCifa[LEX_DUAD_TABLE_LEN];
	char m_tErrorMessage[ERROR_TABLE_LEN][ERROR_MESSAGE_LEN];
	int m_pCurCh;
	char m_tKeyWord[KEY_WORD_TABLE_LEN][MAX_LEX_LEN];
	int FindInCifaTab(char *);
	int FindInKeyWordTab(char *);
	void Initial();
	void NextCh();
	char GetCh();
	char GetCurCh();
	char GetNextCh();

};

#endif // !defined(AFX_COMPILER_H__0B392D63_565E_4D11_8668_F37CDF11364E__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -