-
Notifications
You must be signed in to change notification settings - Fork 0
/
SymbleTable.h
91 lines (62 loc) · 1.78 KB
/
SymbleTable.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
//
// Created by 黄继辉 on 2019-10-30.
//
#ifndef ERROR_HANDLE_SYMBLETABLE_H
#define ERROR_HANDLE_SYMBLETABLE_H
#include "LexicalAnalyzer.h"
#define MAX_NUM_OF_BZF 1000
#define HASH_LENGTH 13
#define DATATYPE_INT_VALUE 0
#define DATATYPE_CHAR_VALUE 1
#define DATATYPE_INT_ARRAY 2
#define DATATYPE_CHAR_ARRAY 3
#define DATATYPE_VOID_NORETURN 4
#define DATATYPE_INT_RETURN 5
#define DATATYPE_CHAR_RETURN 6
#define DATATYPE_INT_CONST 7
#define DATATYPE_CHAR_CONST 8
typedef struct struct_sub_ST {
char name[MAXTXTLENGTH];
int dataType;
int offset;
int length;
int rName;
int isInRegister;
} SubFHB;
typedef struct struct2 {
char name[MAXTXTLENGTH];
int dataType;
int csbLength;
int nextnode;
int paraType[200];
int numVars = 0;
SubFHB *subFHB;
int numTempVars = 0;
SubFHB *subTempFHB;
int stacklength;
int slength;
int tlength;
int offset2Reg[MAX_NUM_OF_BZF];
} FHB;
void insertSymbleTable(char n[MAXTXTLENGTH], int dt, int cl);
void insertArrayLengthSymbleTable(int v);
int hashSymbleTable(char n[MAXTXTLENGTH]);
void deleteSymbleTable();
void addSymbleTableBlock();
int hasSymble(char n[MAXTXTLENGTH]);
int dupicateSymble(char n[MAXTXTLENGTH]);
int updateSymbleTable();
int getDefaultType();
int getType(int index);
int getCSL(int index);
int getCSType(int index,int pos);
int getFuncType();
int symbleType2McodeType(int symbletype);
void insertSubSymbleTable(char n[MAXTXTLENGTH], int dt, int cl, int istemp);
FHB *getSymbleTableByName(char *name);
int findStatedVarible(FHB *FHB, char *name);
int findTempVarible(FHB *FHB, char *name);
int findVarible(FHB *FHB, char *name);
void setTempDataType(char name[], int dt);
int *addInlineTemp(FHB *fhb, int newtempnum, int *tempids);
#endif //ERROR_HANDLE_SYMBLETABLE_H