📄 dfa.h
字号:
#ifndef DFA_HEADER#define DFA_HEADER#include"TransitionTable.h"#include"AdjacentTable.h"#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <stack>using namespace std;class DFA
{
public:
DFA();
~DFA(); void prepare(char* re,char*file);
void FindMatchingPatternInFile(char*file);
private:
char *exp; //stores the regular expression
char *post; //stores the postfix expression
char *edge; //stores the terminal of the expression
int edgeNumber; // the number of the terminal
int **DStates;
int **Dtran;
int *AcceptStates;
int DStatesNumber;
int DtranNumber;
int NFAStatesNumber;
int DFAStatesNumber;
AdjacentTable *NFATable;
TransitionTable *DFATable; void GetRegExp(); //get the regular expression from the console
void InsertCatNode(); // Insert dot to represent catenation
void RegExpToPost(); //Change the regular expression into the postfix form according to the operatpor priority
void GetAllTerminals(); //Scan the post order string to get the number of the terminals
void ThompsonConstruction(); //Construct NFA using Thompson's rule
void SubsetConstruction();
int getPriority(char symbol);//Define the priority of the operator
int CompArray(int *t1, int *t2);
int MinimizeDFAStates(int **Dtran, int *AcceptStates, int DtranNumber, int edgeNumber);
void RemoveFirstSymbol(char *buf, int &len);
};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -