parser.h
来自「一个简单的图形解释语言编译程序,使用visual C++ 6.0开发」· C头文件 代码 · 共 73 行
H
73 行
// 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 + =
减小字号Ctrl + -
显示快捷键?