-
Notifications
You must be signed in to change notification settings - Fork 1
/
HashTreeDef.h
58 lines (52 loc) · 1.38 KB
/
HashTreeDef.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
// Batch Number - 38
// 2014A7PS102P - RISHABH JOSHI
// 2014A7PS248P - DEEP VYAS
#ifndef _HASHTREEDEF_
#define _HASHTREEDEF_
#include "parserDef.h"
#include "lexerDef.h"
#include "ASTDef.h"
#define NOC 20
struct HashTableNode{
char key[LEXEME_SIZE];
char function_name[LEXEME_SIZE];
tokenInfo* tokenptr;
ASTNode *ast_node;
int datatype;
int startscope;
int endscope;
int offset;
/*These parameters are for use in modules.*/
ASTNode* input_plist[NOC];
ASTNode* output_plist[NOC];
int defined;
/*End*/
// For for loop restriction
int readOnly;
// For chekcing return types assigned in module declarations
int assignedFlag;
struct HashTableNode *next;
};
typedef struct HashTableNode HashTableNode;
typedef struct{
HashTableNode *head;
}HashElement;
struct HashTreeNode{
char table_name[LEXEME_SIZE];
char function_name[LEXEME_SIZE];
HashElement *table;
struct HashTreeNode* childQ[NOC];
int tail;
int curr_offset;
struct HashTreeNode *parent;
};
typedef struct HashTreeNode HashTreeNode;
HashTreeNode* initTree();
HashTreeNode* addchild2(HashTreeNode *node);
int hashKey2(char *key);
HashTableNode* find2(char *key,HashTreeNode *node,int res);
int addKey2(ASTNode *ast_node,HashTreeNode *node);
void add_plist(HashTableNode *ele,ASTNode *node);
void printHashTree(HashTreeNode *htroot, int level);
void printHashNode(HashTableNode *hnode,char *fname,int level);
#endif