symbol_table.h

来自「一个C语言的词法分析器」· C头文件 代码 · 共 56 行

H
56
字号
/*++
		module name: symbol.h
		some functions and vars' declaration to manage symbol tables
--*/
#ifndef _SYMBOL_TABLE
#define _SYMBOL_TABLE

#include "global_def.h"
/******************************************************/
#define RESERVE_TABLE_LEN		18
#define SPECIFIER_TABLE_LEN		40
#define MAX_NODE_LENGTH		    15	/* 界符和运算符 and 保留字最大长度 不含'\0' */	
#define MAX_STR_LENGTH			256 /*  字符串最大长度 */
/* 保留字和界符_运算符表表项 */
typedef struct
{
	int   type;
	char  str [MAX_NODE_LENGTH +1];
}TABLE_NODE;
/* we don't have to expose these vars to user */
/*
extern int    cst_num_table [MAX_NUM];
extern double cst_real_table[MAX_NUM];
extern char   cst_char_table[MAX_NUM];
extern char   cst_str_table [MAX_NUM][MAX_LENGTH];

extern char   identifier_table[MAX_NUM][MAX_LENGTH];

extern int    cst_num_length;
extern int    cst_real_length;
extern int    cst_char_length;
extern int    cst_str_length;

extern int    identifier_length;
*/
/************************************************************/
void *query_cst_num   (int    cst_num   );
void *query_cst_real  (double cst_real  );
void *query_cst_char  (char   cst_char  );
void *query_cst_str   (char  *cst_str   );
void *query_identifier(char *identifier );

ENTRY query_reserve_table    (char *str );
ENTRY query_specifier_table  (char *str );

void *add_cst_num     (int    cst_num   );
void *add_cst_real    (double cst_real  );
void *add_cst_char    (char   cst_char  );
void *add_cst_str     (char  *cst_str   );

void *add_identifier  (char *identifier );

#endif	/* _SYMBOL_TALE */
/********************************end of file*********************************/

  

⌨️ 快捷键说明

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