diff options
author | pacien | 2018-05-07 01:33:55 +0200 |
---|---|---|
committer | pacien | 2018-05-07 01:33:55 +0200 |
commit | 15390a3b612562a8f1c995e968cd3b1943375ab9 (patch) | |
tree | 23fdd2a5b680bf18f3505199b11a2e5ed2786271 /src/symbol_table.h | |
parent | 49662d2162ef19a137faf17736fb7641d0b61452 (diff) | |
download | tpc-compiler-15390a3b612562a8f1c995e968cd3b1943375ab9.tar.gz |
Code cleanup and reformating
Diffstat (limited to 'src/symbol_table.h')
-rw-r--r-- | src/symbol_table.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/symbol_table.h b/src/symbol_table.h new file mode 100644 index 0000000..9926fec --- /dev/null +++ b/src/symbol_table.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /** | ||
2 | * UPEM / Compilation / Projet | ||
3 | * Pacien TRAN-GIRARD, Adam NAILI | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYMBOL_TABLE_H__ | ||
7 | #define __SYMBOL_TABLE_H__ | ||
8 | |||
9 | #include <stdio.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <string.h> | ||
12 | |||
13 | #define MAXNAME 32 | ||
14 | #define INT 0 | ||
15 | #define CHAR 1 | ||
16 | #define MAXSYMBOLS 256 | ||
17 | |||
18 | typedef struct { | ||
19 | char name[MAXNAME]; | ||
20 | int type; | ||
21 | int addr; | ||
22 | } STentry; | ||
23 | |||
24 | typedef struct { | ||
25 | STentry entries[MAXSYMBOLS]; | ||
26 | int maxsize; | ||
27 | int size; | ||
28 | } SymbolTable; | ||
29 | |||
30 | void glo_addVar(const char name[], int type); | ||
31 | int glo_lookup(const char name[]); | ||
32 | int glo_get_addr(const char name[]); | ||
33 | void glo_display_table(); | ||
34 | void loc_addVar(const char name[], int type); | ||
35 | int loc_lookup(const char name[]); | ||
36 | int loc_get_addr(const char name[]); | ||
37 | void loc_display_table(); | ||
38 | void check_expected_type(int type_to_check, int type_expected); | ||
39 | |||
40 | #endif | ||