-
Notifications
You must be signed in to change notification settings - Fork 2
/
idsymboltable.h
53 lines (44 loc) · 1.18 KB
/
idsymboltable.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
/*
BATCH NO. 27
Mayank Agarwal (2014A7PS111P)
Karan Deep Batra(2014A7PS160P)
*/
#ifndef _idsymboltable_h_
#define _idsymboltable_h_
#include "symboltable.h"
#include "hashtable.h"
#include "token.h"
#include "stack.h"
#define idsymboltablesize 100
enum types {integer = 0, real = 1, boolean = 2, error = 3};
typedef struct idsymboltablenode idsymboltablenode;
typedef struct stacknode stacknode;
struct idsymboltablenode
{
char* idlex;
stacknode* type;
int offset;
idsymboltablenode* next;
int widthofid;
int isAssigned;
};
typedef struct idsymboltable idsymboltable;
struct idsymboltable
{
idsymboltablenode* buckets[idsymboltablesize];
int offset;
int startline;
int endline;
int nestinglevel;
idsymboltable* child;
idsymboltable* sibling;
idsymboltable* parent;
char* func_name;
};
idsymboltable* makeidsymboltable();
idsymboltablenode* makeidsymboltablenode(char* idlex, stacknode* type, int offset);
idsymboltablenode* insertidsymboltablenode(char* idlex, stacknode* type, int offset, idsymboltable* idst);
idsymboltablenode* getidsymboltablenode(char* idlex, idsymboltable* idst);
void printidsymboltable(idsymboltable* idst);
void printFunctionTable(idsymboltable* idst);
#endif