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

📄 codeeditview.h

📁 一个用VC++开发的Pascal编译器. 包括词法分析 语法分析 语义分析 中间代码生成 对学习编译原理的同学有很大用途
💻 H
字号:
#if !defined(AFX_CODEEDITVIEW_H__D2FF40A5_A154_4AB8_A41B_8A67F5255AF5__INCLUDED_)
#define AFX_CODEEDITVIEW_H__D2FF40A5_A154_4AB8_A41B_8A67F5255AF5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Compiler.h"
#include "IEOFM.h"
#include "ObjModel.h"

#include <vector>
using namespace std;

#define	mMOV	1;
#define	mADD	2;
#define	mSUB	3;
#define	mMUL	4;
#define	mCMP	5;
#define	mJMP	6;
#define	mJNZ	7;
#define	mJA		8;
#define mJB		9;
#define mJNB	10; // >=
#define mJNA	11; // <=
#define	mJNE	12; // <>
#define	mJE		13; // ==


// CodeEditView.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CCodeEditView view

class CCodeEditView : public CEditView
{
protected:
	CCodeEditView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CCodeEditView)

// Attributes
public:
	vector<IEOFM>	m_IEOFM;	//存放四元式串的内部表示
	vector<ObjModel> m_Obj;		//存放生成的目标代码
	ObjModel		m_ObjModel;	//目标代码表示对象
	IEOFM			m_iFourModel;	//四元式内部表示对象
	int				arg1type;		//第一操作数类型
	int				arg2type;		//第一操作数类型
	int				resulttype;		//第一操作数类型
	CString			OP[ 14 ];		//操作码字串
/*这里约定:	0 立即数或跳转四元式编号
			1 变量
			2 临时变量
			3 无意义(该参数缺省)
*/

protected:
	CString		m_cFilePath ;		//打开文件路径
	CString		FooterMsg;			//消息尾
	CString		HeaderMsg;			//消息头
	CString		errornum;			//错误数目

// Operations
public:
	void BackPatchAddr(int address[]);
	void GenObj();
	void OutObj();
	CString TypeToStr(int type);
	CString GetOp(int OP);
	void	OutSymbolRecord(vector<SymbolRecord>);
	void	OutErrorTableDetail(CCompiler);
	void	OutFourModel(vector<SymbolRecord>,vector<QuadRuple>);
	CString	GetArg1(int OP,int arg,vector<SymbolRecord>);
	CString	GetArg2(int OP,int arg,vector<SymbolRecord>);
	CString GetResult(int OP, int arg, vector<SymbolRecord>);
	CString GetStr();
	CString GetFilePath();
	void SetFilePath(CString str);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCodeEditView)
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CCodeEditView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:
	//{{AFX_MSG(CCodeEditView)
	afx_msg void OnFileOpen();
	afx_msg void OnFileNew();
	afx_msg void OnCompile();
	afx_msg void OnUpdateCompile(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(AFX_CODEEDITVIEW_H__D2FF40A5_A154_4AB8_A41B_8A67F5255AF5__INCLUDED_)

⌨️ 快捷键说明

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