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

📄 parser.h

📁 一个简单的图形解释语言编译程序,使用visual C++ 6.0开发
💻 H
字号:
// Parser.h: interface for the CParser class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PARSER_H__EAEE30FB_2CDD_477C_835B_585836403C22__INCLUDED_)
#define AFX_PARSER_H__EAEE30FB_2CDD_477C_835B_585836403C22__INCLUDED_

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


#include "Lex.h"
#include <stdio.h>
#include <stdarg.h>
#include <windows.h>
#include <wingdi.h>

typedef double(*FuncPtr)(double);
struct ExprNode
{
	enum Token_Type OpCode;
	union UnionContent
	{
		struct  Operator {ExprNode *Left,*Right;} CaseOperator;
		struct  Func {ExprNode *Child;FuncPtr MathFuncPtr;} CaseFunc;
		double CaseConst;
		double *CaseParmPtr;
		
	} Content;
};
class CParser  
{
public:
	CParser();
	virtual ~CParser();
	void Parser(char *FileName,HDC hDC);
	void SyntaxError(int caseof);
	void FetchToken();
	void ErrMsg(int LineNo,char *descrip,char *str);
	void Program();
	void Statement();
	void MatchToken(enum Token_Type tokentype);
	void OrignStatement();
	struct ExprNode *Expression();
	struct ExprNode *Term();
	struct ExprNode*Factor();
	struct ExprNode*Comp();
	struct ExprNode*AtomComp();
	struct ExprNode*MakeExprNode(enum Token_Type opcode,...);
	void PrintSyntaxTree(ExprNode *root,int indent);
	void DelExprTree(ExprNode*root);
	double GetExprValue(ExprNode *root);
	void ScaleStatement(void);
	void RotStatement(void);
	void ForStatement(void);
	void DrawLoop(double Start,double End,double Step,
							ExprNode *HorPtr,ExprNode*VerPtr);
	void CalcCoord(ExprNode*Hor_Exp,ExprNode*Ver_Exp);
	void DrawPixel();
	CLex mylex;
	Token m_token;
	double Parameter,
		Origin_x,Origin_y,
		x,y,
		Scale_x,Scale_y,
		Rot_angle;
	HDC hdc;

};

#endif // !defined(AFX_PARSER_H__EAEE30FB_2CDD_477C_835B_585836403C22__INCLUDED_)

⌨️ 快捷键说明

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