diff options
author | Adam NAILI | 2018-04-22 14:49:42 +0200 |
---|---|---|
committer | Adam NAILI | 2018-04-22 14:49:42 +0200 |
commit | 40f423a4b3b1e64e8424ab239cc14ecc5077640f (patch) | |
tree | c7da7c2eed97d62cc8ab2e003293935cda5a93dc /src/symboltable.h | |
parent | c0802bc17f856546b95a5b51252f7a35d9e1ab10 (diff) | |
download | tpc-compiler-40f423a4b3b1e64e8424ab239cc14ecc5077640f.tar.gz |
Beginning of the symbol table implementation
Diffstat (limited to 'src/symboltable.h')
-rw-r--r-- | src/symboltable.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/symboltable.h b/src/symboltable.h new file mode 100644 index 0000000..cc828fa --- /dev/null +++ b/src/symboltable.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef __SYMBOLTABLE_H__ | ||
2 | |||
3 | #include <stdio.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <string.h> | ||
6 | |||
7 | #define MAXNAME 32 | ||
8 | #define INT 0 | ||
9 | #define CHAR 1 | ||
10 | #define MAXSYMBOLS 256 | ||
11 | |||
12 | |||
13 | typedef struct { | ||
14 | char name[MAXNAME]; | ||
15 | int type; | ||
16 | } STentry; | ||
17 | |||
18 | |||
19 | typedef struct { | ||
20 | STentry entries[MAXSYMBOLS]; | ||
21 | int maxsize; | ||
22 | int size; | ||
23 | } SymbolTable; | ||
24 | |||
25 | |||
26 | void addVar(const char name[], int type); | ||
27 | void lookup(const char name[]); | ||
28 | void display_table(); | ||
29 | |||
30 | #endif \ No newline at end of file | ||