symtab.h

来自「在linux下实行的简单的c语言编译器」· C头文件 代码 · 共 71 行

H
71
字号
//Symtab.h
/************************************
  REVISION LOG ENTRY
  Revision By: 方文宾 (0410706)
  Revised on 2006-12-24 17:11:03
  Comments: 符号表相关操作
 ************************************/

#ifndef _SYMTAB_H#define _SYMTAB_H#include "Global.h"/*used in hash function*/#define SHIFT 4extern Symtab *GlobalTable;extern Symtab *pTable;extern FunEntry *FunTable[SIZE];
// Function name	: *CreateTab
// Description	    : 创建符号表
// Return type		: Symtab --创建好的符号表结构
// Argument         : Symtab *pTable --欲创建的符号表的父符号表
// Argument         : FunEntry *pEntry --该符号表所属的函数表
Symtab *CreateTab(Symtab *pTable, FunEntry *pEntry);
// Function name	: *Insert_Var
// Description	    : 在符号表中插入变量
// Return type		: ValEntry --该变量的结构
// Argument         : Symtab *pTable --目标符号表
// Argument         : char *name --变量名
// Argument         : Type type --变量类型
// Argument         : int count --在作用域内是第几个变量
ValEntry *Insert_Var(Symtab *pTable, char *name, Type type, int count);
// Function name	: Lookup_Var
// Description	    : 查找变量是否在相应符号表中
// Return type		: int  --1表示找到,-1表示没找到
// Argument         : Symtab *pTable --当前作用域的符号表
// Argument         : FunEntry *pFun --当前函数(用来查是否在参数中)
// Argument         : char *name --变量名
// Argument         : ValEntry *pEntry --出口参数
int Lookup_Var(Symtab *pTable, FunEntry *pFun, char *name, ValEntry *pEntry);
// Function name	: *Insert_Fun
// Description	    : 在函数表中插入函数
// Return type		: FunEntry --插入好的函数
// Argument         : char *name --函数名
// Argument         : Type type --函数类型
// Argument         : TreeNode *pTreNode --该函数所在树结点
FunEntry *Insert_Fun(char *name, Type type, TreeNode *pTreeNode);
// Function name	: *Lookup_Fun
// Description	    : 查找函数
// Return type		: FunEntry --找到的函数结点 
// Argument         : char *name --函数名
FunEntry *Lookup_Fun(char *name);
// Function name	: printFunTab
// Description	    : 打印函数表
// Return type		: void 
void printFunTab();
// Function name	: printSymTab
// Description	    : 打印符号表
// Return type		: void 
// Argument         : TreeNode *tree
void printSymTab(TreeNode *tree);#endif

⌨️ 快捷键说明

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