-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSymbolTableDef.h
80 lines (70 loc) · 1.5 KB
/
SymbolTableDef.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// GROUP 39
// AKANKSHYA MISHRA 2016A7PS0026P
// NARAPAREDDY BHAVANA 2016A7PS0034P
// KARABEE BATTA 2016A7PS0052P
// AASTHA KATARIA 2016A7PS0062P
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "AST.h"
#define LEN_HT 41
#define INT_WIDTH 2
#define REAL_WIDTH 4
typedef struct Ele{
ASTNodeIt *node;
struct Ele *next;
}Ele;
#define ELEM
#include "stack.h"
typedef struct Element Element;
typedef struct hT hash_ele;
typedef struct hT{
char *str;
Element *ele;
hash_ele *next;
}hash_ele;
typedef hash_ele **HashTable;
HashTable globalSymbolTable;
HashTable SymbolTable;
typedef struct symTableElem{
type* t;
int width;
int offset;
}symTableElem;
typedef struct{
bool tag;
char *ret_par;
}out; //Should be made NULL for in_pars
typedef struct SeqListPars{
bool out_flg;
type *t;
out *out_check;
struct SeqListPars *next;
}SeqListPars;
typedef struct rec{
char *rec_id;
ASTNodeIt *record_ptr;
int width;
}rec;
typedef struct globalTableElem{
bool is_record;
union{
type* t;
rec* rec_type_list;
}u;
int offset;
}globalTableElem;
typedef struct symT{
SeqListPars *in_pars;
SeqListPars *out_pars;
HashTable SymbolTable;
}symT;
typedef struct Element{
int flag;
//0 for FUN_ID hashtable, 1 for Symbol Table for a function, 2 for global hashtable(containing global variables and record definitions)
union{
symT* out_table;
symTableElem *s;
globalTableElem *g;
}u;
}Element;