📄 symtable.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -