-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsymtab.h
More file actions
59 lines (42 loc) · 1.26 KB
/
symtab.h
File metadata and controls
59 lines (42 loc) · 1.26 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _SYMTAB_H_
#define _SYMTAB_H_
#include "globals.h"
#define SIZE 211
// The list of line numbers for a symbol
typedef struct LineListRec{
int lineno;
struct LineListRec *next;
} * LineList;
// Bucket list for each symbol. Containing its properties
typedef struct BucketListRec{
char *name;
LineList lines;
int loc;
NodeKind kind;
int subKind;
int arrSize;
TokenType type;
struct BucketListRec *next;
} * BucketList;
typedef struct HashTableRec{
BucketList hashTable[SIZE];
int scope;
int location;
int visited;
struct HashTableRec *outer;
struct HashTableRec *inner;
} * HashTableList;
/* Initialze symbol table list */
void initSymbolTable(void);
void intoNewScope(void);
void closeScope(void);
void inScope(void);
void outScope(void);
/* Inserts symbol and its properties to symbol table */
void st_insert(char * name, int lineno, NodeKind kind, int subKind, int arrSize, TokenType type, BucketList found);
void insertAllPrmt(BucketList);
/* Find the symbol which has the certain name */
BucketList st_lookup(char * name, int lookupMode);
/* Prints a formattedx listing of the symbol table contents */
void printSymTab(FILE *listing);
#endif