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

📄 pre_table.h

📁 本程序主要实现预测分析表的构造
💻 H
字号:
#include <iostream>
#include <string>
using namespace std;

struct Term
{
	string gram;
	string first;
	Term *link;
	Term(string &str,Term *pl=NULL)
	{
		gram=str;
		link=pl;
	}
};


struct LTerm
{
	string gram;
	bool flag;
	string first,follow;
	LTerm *next;
	Term *link;
	LTerm(string &str,LTerm *pn=NULL,Term *pl=NULL)
	{
		gram=str;
		next=pn;
		link=pl;
		flag=false;
	}
};


class Pre_Analysis_Table
{
	LTerm *head;
	void add(string &from,string &to,int fg=0);
	LTerm *go(char ch);
	void First(LTerm *ptr);
	void Follow(LTerm *ptr);
	bool is_exist(char ch,string &str);
	void print_set(string &str);
public:
	Pre_Analysis_Table():head(NULL){}
	void construct();
	void First_And_Follow();
//	void product_table();
	void print_First_And_Follow();
	void print_table();
	~Pre_Analysis_Table();
};

	

⌨️ 快捷键说明

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