pre_table.h

来自「本程序主要实现预测分析表的构造」· C头文件 代码 · 共 54 行

H
54
字号
#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 + =
减小字号Ctrl + -
显示快捷键?