-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymbolDef.h
130 lines (109 loc) · 1.78 KB
/
symbolDef.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* COMPILER PROJECT- ERPLAG COMPILER
* CSE - D 2019
* Sahil Garg, Jenit Jain, Amrit Goyal
*/
#ifndef symbolDef
#define symbolDef
#include "lexerDef.h"
//List of Definitions for Hashing Scoped variables/functions
typedef struct IDEntry IDEntry;
typedef enum{defined, declared}funcStatus;
#define hash_capacity_2 31
struct linklist2
{
IDEntry *ID;
struct linklist2 *next;
};
struct store2
{
int code;
IDEntry *node;
};
struct entry2
{
IDEntry *ID;
status flag;
struct linklist2 *start;
};
typedef struct store2 store2;
typedef struct entry2 entry2;
typedef struct linklist2 linklist2;
typedef entry2 *hashTable2;
//List of Definitions for Symbol Table entries for variables/functions
int semantic_status;
struct variable
{
term type;
};
struct array
{
term type;
int s_idx, e_idx;
};
struct IDVariable
{
char word[21];
int lno;
int scope;
int code;
int v_a;
int bytes;
int depth;
int offset;
char func_name[21];
union
{
struct variable v;
struct array a;
}var;
};
struct parameter
{
union
{
struct variable v;
struct array a;
}var;
int v_a;
struct parameter *next;
};
struct IDFunction
{
char word[21];
int lno;
int used;
int scope;
funcStatus status;
struct parameter *inputList;
struct parameter *outputList;
};
struct IDEntry
{
union
{
struct IDVariable ivar;
struct IDFunction ifunc;
}entity;
};
struct scopeChain
{
int scope;
int in_cond;
int in_loop;
struct scopeChain *next;
struct scopeChain *prev;
};
struct totalScopeList
{
int scope_start;
int scope_end;
};
typedef struct variable variable;
typedef struct array array;
typedef struct IDVariable IDVariable;
typedef struct scopeChain scopeChain;
typedef struct totalScopeList totalScopeList;
typedef struct parameter parameter;
typedef struct IDFunction IDFunction;
#endif