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

📄 cifadlg.h

📁 simple语言的词法和语法分析
💻 H
字号:
// CIFADlg.h : header file
//

#if !defined(AFX_CIFADLG_H__5A1C94AB_F5F4_4DA4_80E8_0B6FF8670CB0__INCLUDED_)
#define AFX_CIFADLG_H__5A1C94AB_F5F4_4DA4_80E8_0B6FF8670CB0__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CCIFADlg dialog
struct cifa
{
	int entry;		//入口地址
	int kind;		//种别码,为-1时结束,为0时错误
	int length;		//单词长度
	char type[10];	//标识符类型
	int val;		//常数标识符的值
	int addr;		//源文件缓冲区中地址
};

class CCIFADlg : public CDialog
{
public:
	int n,tn;				//分别为源程序下标和词法下标
	char strtable[1000];	//字符串表
	char program[1000];		//源程序
	char word[20];
	char kw[61][20];		//SIMPLE语言单词的编码
	cifa m_cifa[10000];		//词法分析结果
	int p;					//字符串表末地址指针
	CString token;			//token串
	CString str;
	int en;					//错误个数

// Construction
public:
	char m_szErrMsg[100][50];
	bool chengxuti();
	int m_nErrAddr;
	int m_nErrNo;
	bool yufafenxi();
	int iskeyword(char * tmpstr);
	void lookup();			//查填符号表
	void recogdel();		//识别界限符
	void handlecom();		//处理注解
	void recogdig();		//识别数字常数
	void outputr();			//输出token串
	void recogid();			//识别标识符
	void sort();			//单词分类模块
	CCIFADlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CCIFADlg)
	enum { IDD = IDD_CIFA_DIALOG };
	CEdit	m_yufa;
	CEdit	m_fuhao;
	CEdit	m_result;
	CEdit	m_program;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCIFADlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	bool CanLiang();
	bool Xiang();
	bool XunHuanYuJu();
	bool TiaoJianYuJu();
	bool FuZhiYuJu();
	bool FuHeYuJu();
	bool YuJu();
	bool YuJuChuan();
	bool XingCan();
	bool XingCanBuFeng();
	bool GuoChengShengMing();
	bool BianliangShengMing();
	bool ShengMing();
	bool ShengMingChuan();
	void printerr(CString err);
	int check();			//是否与符号表中有同名,有则返回入口地址,否则返回0
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CCIFADlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnScanner();
	afx_msg void OnYufa();
	afx_msg void OnTest();
	afx_msg void OnFuhao();
	afx_msg void OnAbout();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CIFADLG_H__5A1C94AB_F5F4_4DA4_80E8_0B6FF8670CB0__INCLUDED_)

⌨️ 快捷键说明

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