symtable.h
来自「一个c语言的编译器的源代码」· C头文件 代码 · 共 57 行
H
57 行
#ifndef SYMTABLE_H_
#define SYMTABLE_H_
#define BUCKET_SIZE 211 // Size of the hash symbol table
#include <string>
#include "global.h"
#include "parse.h"
using namespace std;
// For recording symbols
typedef struct symbolrecord{
symbolrecord * pNext;
string name;
Type type;
SymbolType symboltype;
//used only in function declaration
TreeNode * pParamList;
int paramAlloc; //memory params take up
int localAlloc; //memory local-vars take up
int nestlevel;
int location;
int lineno;
} SymbolRecord;
// Symbol table(hash table)
typedef struct bucketlist{
bucketlist * pNext;
SymbolRecord * pRecord[BUCKET_SIZE];
} BucketList;
extern int nestlevel;
extern BucketList GlobalBucket;
extern BucketList * pSymbolTable;
extern BucketList * pCurrentST;
void st_addon(BucketList *p);
void st_takeoff();
BucketList * st_new();
SymbolRecord * st_insert(const string &name, const Type type,
const SymbolType symboltype,
int location,int lineno);
SymbolRecord * st_lookup(const string &name);
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?