-
Notifications
You must be signed in to change notification settings - Fork 9
/
symtab.h
41 lines (26 loc) · 823 Bytes
/
symtab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*build symbol tables
* and function tables
*/
#ifndef SYMTAB_H
#define SYMTAB_H
#include "globals.h"
/* the hash function */
int hash ( char * key );
/* initialize symbol tables*/
void initTable();
/* create a new symbol table of certain scope */
SymbolTable* newSymbolTable(Scope s);
/* manipulate the symbol table stack*/
SymbolTable* topTable();
SymbolTable* popTable();
void pushTable(SymbolTable* st);
/* look up for a symbol entry*/
VarSymbol* lookup_var_top(char* name);
VarSymbol* lookup_var(char * name);
FunSymbol* lookup_fun(char * name);
/* insert symbol entries */
int insert_var(char * name, Scope s, int offset, ExpType type);
int insert_fun(char* name, SymbolTable* st, int num, ExpType type);
/* prints a formatted listing of the symbol table */
void printSymTab(SymbolTable* st);
#endif