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

📄 lexical.h

📁 词法分析器,学编译原理时做的,很简单,可供初学者借鉴
💻 H
字号:
#ifndef LEXICAL_H_
#define LEXICAL_H_

#include <fstream>
using namespace std;

void Scanner();
void IsNumber();
void IsAlpha();
void IsChar();
void IsNotes();
void IsOther();
void Error(int);
void Output();
bool symbleExist();

typedef struct token
{
	int label;
	int code;
	int addr;
	char name[30];
	int line;             //该标志符在程序中的第几行
}token;

typedef struct symble
{
	int code;
	int addr;
	char name[30];
}symble;

typedef struct keyWord                //
{
	int code;
	char name[30];
}keyWord;

const int numOfKeyWord = 26;
const int maxVariable = 200;

int err_count;
int lineOfProc;
int label_count;
int addr_count;
int var_count;
char currentLetter;

token currentToken;
keyWord key[numOfKeyWord];
symble symbleList[maxVariable];
ofstream tokenOut;
ofstream symbleOut;
ifstream keyIn;
ifstream sourceIn;

#endif 

⌨️ 快捷键说明

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