www.pudn.com > WordScanner.rar > SymbolTable.h


//符号表 
 
//保留字信息数据结构 
typedef struct key_word 
{ 
	int id; //保留字类编号 
	char name[10]; //保留字字符本身 
}key_word; 
//保留字表 
key_word key_word_table[11]={{1,"begin"},{2,"end"},{3,"if"},{4,"then"},{5,"else"}, 
							{6,"for"},{7,"do"},{8,"while"},{9,"and"},{10,"or"},{11,"not"}}; 
//标识符信息数据结构 
typedef struct id_struct 
{ 
	int id; //标识符类编号,分析器中统一为12 
	char * p; //指向标识符字符串本身的指针 
	id_struct *next; //指向下一个标识符结构体 
}id_struct; 
//id_struct * id_head=NULL; //全局变量,指向标识符结构体链表的开始 
 
//常量信息数据结构 
typedef struct const_struct 
{ 
	int id; //常量类别编号 
	char * value; //常量值 
	const_struct * next; 
}const_struct; 
const_struct * const_head=NULL; //全局变量,指向常量结构体链表的开始