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

📄 lexicalanalyzer.h

📁 对象为c语言子集的词法分析程序 个人的课程代码
💻 H
字号:
#pragma once
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <assert.h>
#include <iostream>
#include <string>
#include <queue>
using namespace std;
#include "SymbolTable.h"

class LexicalAnalyzer
{
public:
//	static LexicalAnalyzer* getInstance(string src);
	string getNextToken(string& token);
	bool eof();
	LexicalAnalyzer(char* src);
	~LexicalAnalyzer(void);
private:
	void transLetter(int startState, int endState);
	void transDigit(int startState, int endState);
	void transEpsilon(int startState, int endState);
	void transWhite();
	set<int> move(set<int> S, char a);
	set<int> getEpsilonClosure(set<int> T);
	SymbolTable symbTbl;
	char getNextChar();

//	static LexicalAnalyzer* instance;
	set<int>** transitionTable;
	queue<char> innedSq;
	queue<char> lastSq;
	int curLexLen;
	int NUM_OF_STATES;
	ifstream infile;
	string currentToken;
	int currentFinalState;
	bool* isFinal;
};

⌨️ 快捷键说明

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