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

📄 ruleset.h

📁 这是一个用c++写的预测分析法程序,是编译原理课程设计的内容,可以预测分析语言
💻 H
字号:

#include "Table.h"

struct  FOLLOW_SET     
{
	SIGN      Sign;       // 符号
	SIGN_SET  FollowSet;  // FOLLOW 符号集合
	FOLLOW_SET(); 
	~FOLLOW_SET();
	void      Compact();  // 压缩:去掉右边重复的,以及和左边符号相同的符号
	int       GetNonTerminalSignNum();	
};

class RULE_SET
{
public:
	RULE_SET();	
	~RULE_SET();

	int   GetRuleNum();
	RULE  GetRule(int);
	void  AddRule(RULE);	
	void  Reset();

	bool  IsLeftRecursive();
	bool  SetStartSign(SIGN);	
	SIGN  GetStartSign();
	TABLE CreateSELECTTable();
private:
	bool		CanPushOutNULLString(SIGN);
	bool		CanPushOutNULLString(const SIGN_SET&);
	SIGN_SET	GetFIRSTSignSet(SIGN);
	void	    GetFIRSTSignSet(const SIGN_SET&,SIGN_SET&);

	int         CalcFOLLOWSet();
	SIGN_SET    GetFollowSet(SIGN);
	void        CalcSELECTSet();

	bool        CheckLeftRecursive(); 	
	bool        CanBeginWithSign(SIGN,SIGN,SIGN_SET&);
private:
	bool  FollowSetCalced;   // 是否已经计算过 FOLLOW 集	

	SIGN  StartSign;
	int   RuleNum;	         // 规则数
	RULE* pRules;            // 各规则
	int   NonTerSignNum;     // 非终极符个数
	FOLLOW_SET* FollowSet;   // FOLLOW 集合
	TABLE SelectTable;
};

⌨️ 快捷键说明

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