aboutsummaryrefslogtreecommitdiff
path: root/src/symbol_table.h
diff options
context:
space:
mode:
authorpacien2018-05-07 01:33:55 +0200
committerpacien2018-05-07 01:33:55 +0200
commit15390a3b612562a8f1c995e968cd3b1943375ab9 (patch)
tree23fdd2a5b680bf18f3505199b11a2e5ed2786271 /src/symbol_table.h
parent49662d2162ef19a137faf17736fb7641d0b61452 (diff)
downloadtpc-compiler-15390a3b612562a8f1c995e968cd3b1943375ab9.tar.gz
Code cleanup and reformating
Diffstat (limited to 'src/symbol_table.h')
-rw-r--r--src/symbol_table.h40
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
18typedef struct {
19 char name[MAXNAME];
20 int type;
21 int addr;
22} STentry;
23
24typedef struct {
25 STentry entries[MAXSYMBOLS];
26 int maxsize;
27 int size;
28} SymbolTable;
29
30void glo_addVar(const char name[], int type);
31int glo_lookup(const char name[]);
32int glo_get_addr(const char name[]);
33void glo_display_table();
34void loc_addVar(const char name[], int type);
35int loc_lookup(const char name[]);
36int loc_get_addr(const char name[]);
37void loc_display_table();
38void check_expected_type(int type_to_check, int type_expected);
39
40#endif