-
Notifications
You must be signed in to change notification settings - Fork 0
/
symbolTable.h
40 lines (35 loc) · 962 Bytes
/
symbolTable.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
#if !defined(AST)
#define AST
#include "AST.h"
#endif
typedef struct TableEntry{
int count;
Typee type;
char* name;
int array;
int isParam;
struct TableEntry* next;
} TableEntry;
typedef struct TableHeadline{
char* name;
struct TableEntry* firstEntry;
struct TableHeadline* next;
struct TableHeadline* child;
struct TableHeadline* parent;
} TableHeadline;
typedef struct SymbolTable {
struct TableHeadline* global;
struct TableHeadline* current;
Typee currType;
int isParam;
} SymbolTable;
SymbolTable* initTable();
void destroy(SymbolTable* table);
void printTable(SymbolTable* table, FILE* stream);
void printHeadline(TableHeadline* head, FILE* stream);
void printEntry(TableEntry* entry, FILE* stream);
void setParam(SymbolTable* table, int param);
void newType(SymbolTable* table, Typee type);
void goToParent(SymbolTable* table);
void addEntry(SymbolTable* table, char* name, int array);
void goToChild(SymbolTable* table, char* name);