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

📄 faceview.h

📁 产生一个编译器,包含词法分析
💻 H
字号:
// faceView.h : interface of the CFaceView class
//
/////////////////////////////////////////////////////////////////////////////

#include "scan.h"
#include "parse.h"
#include "parseLL1.h"
#include "analyze.h"
#include "midcode.h"
#include "constOpti.h"
#include "eccOpti.h"
#include "loopOpti.h"
#include "midtodemi.h"
#include "treetodemi.h"
#include "tm.h"

#include "string.h"

#if !defined(AFX_FACEVIEW_H__41107A5F_F938_417D_8386_0699D530BD69__INCLUDED_)
#define AFX_FACEVIEW_H__41107A5F_F938_417D_8386_0699D530BD69__INCLUDED_

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


class CFaceView : public CEditView
{
protected: // create from serialization only
	CFaceView();
	DECLARE_DYNCREATE(CFaceView)
	CFont  m_fontEdit;

// Attributes
public:
	CFaceDoc* GetDocument();


    //词法分析
	Cscan		myscan;
	//语法分析
	Cparse		myparse;
	CparseLL1	myparseLL1;

	//语义分析
	Canalyze	myanalyze;
	//中间代码生成
	Cmidcode    mymidcode;
	//常表达式优化
	CconstOpti  myconOpti;
	//公共表达式优化
	CeccOpti    myeccOpti;
	//循环不变式优化
	CloopOpti   myloopOpti;
	//从中间代码生成目标代码
	Cmidtodemi  mymidtodemi;
	//从语法树生成目标代码
	Ctreetodemi  mytreetodemi;
	//解释程序
	Ctm    mytm;

	//源文件名
	CString  pgm;
    //语法树:
	Cglobal::TreeNode   *tree;
	//中间代码:
	Cglobal::CodeFile   *midcode;
	
	//纪录主程序的display表的偏移,语义分析阶段得到
	int  StoreNoff;

	//目标文件名
	char  *codefile;


	// Operations
public:
    CMenu  *m_pOptimize;

	//单步执行各阶段执行标志:
	bool  DOSCANFLAG;
	bool  DOPARSEFLAG;
	bool  DOANALYZEFLAG;
    bool  DOMIDCODEFLAG;
	bool  DODEMICODEFLAG;
	bool  SELMIDTODEMI; 
	bool  SELTREETODEMI;

	//编译执行标志:
	bool  DOCOMPILE ;

	//获取当前路径:
	 TCHAR buf[100];


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFaceView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);


	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CFaceView();
    //自定义的三个函数:
	//打开一个文件:
	BOOL OpenNewDocument(const CString&  strTarget);
    //恢复为初始状态:
	void Reset();
	//移去中间代码菜单项:
	void  RemoveMidPart();
	//获取光驱盘符:
	LPCTSTR  SearchDrive();

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

//protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CFaceView)
	afx_msg void OnCompileScan();
	afx_msg void OnCompileAnalyze();
	afx_msg void OnCompileMidtodemi();
	afx_msg void OnCompileTreetodemi();
	afx_msg void OnReadAnalyze();
	afx_msg void OnReadInterpreter();
	afx_msg void OnReadMidcode();
	afx_msg void OnReadMidtodemi();
	afx_msg void OnReadParse();
	afx_msg void OnReadScan();
	afx_msg void OnReadTreetodemi();
	afx_msg void OnCompileIntepreter();
	afx_msg void OnExeAll();
	afx_msg void OnExeInterpre();
	afx_msg void OnReadConstopti();
	afx_msg void OnReadEccopti();
	afx_msg void OnReadLoopopti();
	afx_msg void OnParseDigui();
	afx_msg void OnParseLL1();
	afx_msg void OnCfg();
	afx_msg void OnReset();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnUpdateCompileScan(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCompAnalyze(CCmdUI* pCmdUI);
	afx_msg void OnUpdateParseDigui(CCmdUI* pCmdUI);
	afx_msg void OnUpdateParseLl1(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCompileTreetodemi(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCompileMidtodemi(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCompileIntepreter(CCmdUI* pCmdUI);
	afx_msg void OnMtdDemicode();
	afx_msg void OnOptiConst();
	afx_msg void OnUpdateOptiConst(CCmdUI* pCmdUI);
	afx_msg void OnOptiEcc();
	afx_msg void OnUpdateOptiEcc(CCmdUI* pCmdUI);
	afx_msg void OnOptiLoop();
	afx_msg void OnUpdateOptiLoop(CCmdUI* pCmdUI);
	afx_msg void OnMtdMidcode();
	afx_msg void OnUpdateMtdMidcode(CCmdUI* pCmdUI);
	afx_msg void OnUpdateCompileAnalyze(CCmdUI* pCmdUI);
	afx_msg void OnUpdateMtdDemicode(CCmdUI* pCmdUI);
	afx_msg void OnUpdateExeAll(CCmdUI* pCmdUI);
	afx_msg void OnReadLl1parseA();
	afx_msg void OnReadLl1parseB();
	afx_msg void OnReadParseA();
	afx_msg void OnReadParseB();
	//}}AFX_MSG


	//倒入输出栏文件:
	void  OutPut(CString  str);

	DECLARE_MESSAGE_MAP()
private:
	bool b_scan_check;
	bool b_parse_check;
	bool b_ll1parse_check;
	bool b_analyze_check;	
	
	bool b_treetodemi_check;
	bool b_midtodemi_check;
	
	bool b_midcode_check;
	bool b_OptiConst_check;
	bool b_OptiEcc_check;
	bool b_OptiLoop_check;
	bool b_mtddemi_check;

	bool b_intepreter_check;
	bool b_compile_check;

	//中间代码部分设置为虚
    bool enable_midcode ;
	bool enable_opticonst ;
	bool enable_optiecc ;
	bool enable_optiloop ;
	bool enable_midtodemi ;
};

#ifndef _DEBUG  // debug version in faceView.cpp
inline CFaceDoc* CFaceView::GetDocument()
   { return (CFaceDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_FACEVIEW_H__41107A5F_F938_417D_8386_0699D530BD69__INCLUDED_)

⌨️ 快捷键说明

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