-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsymbol_table.h
88 lines (69 loc) · 2.23 KB
/
symbol_table.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
///////////////////////////////////////////////////////////////////////////////
/* ---------- IMPLEMENTACE INTERPRETU IMPERATIVNÍHO JAZYKA IFJ15 ----------- */
///////////////////////////////////////////////////////////////////////////////
//
// AUTOŘI:
//
// xbedna57 ADAM BEDNÁRIK ()
// xmacha63 ERIK MACHÁČEK ()
// xmalar02 MARTIN MALÁRIK ()
// xklaci00 MICHAL KLACIK ()
// xlengu00 MANH LE NGUYEN ()
//
///////////////////////////////////////////////////////////////////////////////
#ifndef ST_Header
#define ST_Header
#include "str.h"
#include "errors.h"
#include "memory_manager.h"
#include "deque.h"
#include "token.h"
enum symbolType{
ST_VARIABLE,
ST_FUNCTION,
}symbols;
enum variableType{
ST_UNDEFINED,
ST_INT,
ST_DOUBLE,
ST_STRING,
ST_AUTO,
}variables;
typedef struct symbolParamStruct{
string name;
int typ;
}*symbolParamPtr;
typedef struct symbolFunctionStruct{
int returnType;
int defined;
int declared; //prototyp
Deque params; //params
void * symbolTable; //symbol table pro tuto funkci
}*symbolFunctionPtr;
typedef struct symbolVariableStruct{
int type; //variableType
int defined; //defined
string labelPlatnosti; //label ve kterem nejpozdeji plati dana promena
void *data; //pointer to memory
int dataInt;
double dataDouble;
}*symbolVariablePtr;
typedef struct symbolPackegeStruct{
string key; // nazev promene .. u nekterych bude potreba generovat
int typ; //symbolType
void * data; //samotna struktura obsahujici symbol
}*symbolPackagePtr;
symbolPackagePtr ST_PackageCreate(string key, int typ, void * symbol);
void ST_PackageDestroy(symbolPackagePtr symbol);
symbolFunctionPtr ST_FunctionCreate();
void ST_FunctionDestroy(symbolFunctionPtr symbol);
void ST_FunctionAddParam(symbolFunctionPtr symbol, string name, int tokenType);
symbolVariablePtr ST_VariableCreate();
void ST_VariableDestroy(symbolVariablePtr symbol);
string ST_RandomKeyGenerator();
int ST_Compare(symbolPackagePtr symbol1, symbolPackagePtr symbol2);
int ST_CompareFunctions(symbolFunctionPtr symbol1, symbolFunctionPtr symbol2);
int ST_ParamOKV(symbolFunctionPtr symbol, int variableType, int position);
int ST_ParamOKT(symbolFunctionPtr symbol, int tokenType, int position);
int ST_Remap(int tokenTyp);
#endif //ST_Header