www.pudn.com > 4rd.rar > head.h


struct itemtype{	//变量表的数据结构 
	char name[16];	//变量名 
	double value;	//变量值 
	bool evaluated;	//变量是否已赋值,true为已赋值 
}; 
 
struct node{		//语法树结点 
	double code;	//结点类型 
	int entry;		//如果是标识符,保存其在table中的下标 
	double value;	//如果是数字,保存其数值 
	node *left;		//左孩子指针 
	node *right;	//右孩子指针 
	int No;			//生成结点的序号 
}; 
 
struct xy{		//保存坐标 
	int x;		//x坐标值 
	int y;		//y坐标值 
}; 
xy *Pos[100];	//保存所有结点的坐标 
 
itemtype table[100];	//变量表 
int total,identry;	//total:标识符个数;identry:标识符在符号表中的下标 
 
double numval;		//分析数字时保存数值 
char buffer[100];   //存放输入的表达式 
char lookahead;     //当前读取的字符 
int position;		//当前字符位置下标 
char identi[17];	//存放标示符 
char operators[8]={'+','-','*','/','(',')'};	//若输入这些以外的运算符则为错误 
bool isok;		//判断程序是否正常结束,正常结束才输出结果 
int number;		//输出语法树的时候用 
node *root;		//保存生成的语法树的根结点 
 
double variable;	//用于标识符数值的输入 
 
bool m_inVar;	//判断是否要输入变量 
 
int		m_x,m_y;	//根结点坐标 
 
CString string;	//用于输入变量值时传递参数 
 
bool f_error;	//遇到第一个出错位置才报错