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

📄 symtab.h

📁 1.小型编译器 2。支持整数
💻 H
字号:
/****************************************************/
/* File: symtab.h                                   */
/* Symbol table interface							*/
/* for the C_Minus compiler							*/
/****************************************************/

#ifndef _SYMTAB_H_
#define _SYMTAB_H_

/* the power of two used as multiplier
   in hash function */
#define SHIFT 4

extern Symtab * GlobalTable;		//global symble table for variables
extern Symtab * pTable;				//global symble table for variables
extern FunEntry * FunTable[SIZE];	//symble table for functions
extern FunEntry * SysFunTable[SIZE];	//symble table for functions
extern StructEntry * StructTable[SIZE];	//symble table for functions

/* create a new variable table
 * and link it to its parent
 */
Symtab * Createtab(Symtab * pTable, FunEntry *pEntry, StructEntry *pStruct);
/* insert a new entry to the variable table */
ValEntry * Insert_Var(Symtab * pTable, char * name, VExpType type, int count);
/* lookup a variable in the symbol table */
int Lookup_Var(Symtab * pTable, FunEntry * pFun, char * name, ValEntry * pEntry);
/* insert a new entry to the function table */
FunEntry * Insert_Fun(char * name, VExpType type, TreeNode * pTreeNode);
/* lookup a function in the symbol table */
FunEntry * Lookup_Fun(char * name);
int	Lookup_Param(FunEntry * pFun, int index, ValEntry * pEntry);

void	Insert_SysFun();
FunEntry * Lookup_SysFun(char * name);

StructEntry * Insert_Struct(char * name, TreeNode * pTreeNode);
StructEntry * Lookup_Struct(char * name);
int Lookup_Struct_Field(StructEntry *pStruct, char *name, ValEntry * pEntry);

/* procedure printFunTab prints a formatted 
 * listing of the function table contents 
 * to the listing file
 */
void printFunTab(void);

void printStructTab(void);

/* procedure printSymTab prints a formatted 
 * listing of the symbol table contents 
 * to the listing file
 */
void printSymTab(TreeNode * tree);

#endif

⌨️ 快捷键说明

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