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

📄 syntax.h

📁 词法分析程序
💻 H
字号:
// Syntax.h: interface for the Syntax class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SYNTAX_H__FCED9287_0BE2_4156_B64E_AF2A0EC6861B__INCLUDED_)
#define AFX_SYNTAX_H__FCED9287_0BE2_4156_B64E_AF2A0EC6861B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Cifa.h"
#include "OutputTreeView.h"
class Syntax : public Cifa  
{
protected:
	//扫描源程序,直到当前token在synchset[]之中为止
	int Scanto(int synchset[],int n);
	//检查当前token是否在firstset之中,
	//若不在就向下扫描源程序直到当前token在firstset[]或followset[]之中为止
	int Checkinput(int firstset[],int followset[],int firstnum,int follownum);
	//用当前token.tokentype与tokentype比较,
	//若相同则读下一个token,否则进行错误处理
	int Match(int tokentype);
	//匹配标识符Value的子程序
	void Value();
	//匹配标识符Factor的子程序
	void Factor();
	//匹配标识符Term的子程序
	void Term();
	//匹配标识符Simple_expression的子程序
	void Simple_expression();
	//匹配标识符Expression的子程序
	void Expression();
	//匹配标识符Forexpression的子程序
	void Forexpression();
	//匹配标识符Params的子程序
	void Params();
	//匹配标识符Declaration的子程序
	void Declaration();
	//匹配标识符Statement的子程序
	void Statement();
	//匹配标识符Compound_stmt的子程序
	void Compound_stmt();
	//记录程序当前分析的token
	TOKEN temptoken;
//	CSmartCDoc* pdoc;
	//信息输出窗口
	COutputTreeView* ptreeview;
	//以下为各标识符的first follow集
	int ValueFirstSet[2],ValueFollowSet[15];
	int FactorFirstSet[4],FactorFollowSet[14];
	int TermFirstSet[4],TermFollowSet[11];
	int Simple_expressionFirstSet[4],Simple_expressionFollowSet[8];
	int ExpressionFirstSet[4],ExpressionFollowSet[2];
	int ForexpressionFirstSet[2],ForexpressionFollowSet[2];
	int ParamsFirstSet[2],ParamsFollowSet[1];
	int ProgrameFirstSet[2];
	int DeclartionFirstSet[2],DeclartionFollowSet[9];
	int StatementFirstSet[7],StatementFollowSet[9];
	int Compound_stmtFirstSet[1],Compound_stmtFollowSet[11];
public:
	Syntax(CEdit* MyEdit,Error* MyError,COutputTreeView* pView);
	virtual ~Syntax();
	//整个程序对外接口,调用这个子程序分析源代码
	void Programe();
};

#endif // !defined(AFX_SYNTAX_H__FCED9287_0BE2_4156_B64E_AF2A0EC6861B__INCLUDED_)

⌨️ 快捷键说明

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