aboutsummaryrefslogtreecommitdiff
path: root/src/symboltable.h
diff options
context:
space:
mode:
authorAdam NAILI2018-04-22 14:49:42 +0200
committerAdam NAILI2018-04-22 14:49:42 +0200
commit40f423a4b3b1e64e8424ab239cc14ecc5077640f (patch)
treec7da7c2eed97d62cc8ab2e003293935cda5a93dc /src/symboltable.h
parentc0802bc17f856546b95a5b51252f7a35d9e1ab10 (diff)
downloadtpc-compiler-40f423a4b3b1e64e8424ab239cc14ecc5077640f.tar.gz
Beginning of the symbol table implementation
Diffstat (limited to 'src/symboltable.h')
-rw-r--r--src/symboltable.h30
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
13typedef struct {
14 char name[MAXNAME];
15 int type;
16} STentry;
17
18
19typedef struct {
20 STentry entries[MAXSYMBOLS];
21 int maxsize;
22 int size;
23} SymbolTable;
24
25
26void addVar(const char name[], int type);
27void lookup(const char name[]);
28void display_table();
29
30#endif \ No newline at end of file