diff options
author | Adam NAILI | 2018-06-03 15:30:53 +0200 |
---|---|---|
committer | Adam NAILI | 2018-06-03 15:30:53 +0200 |
commit | b8f7e7b6843c2bff778ce3c74e355a03e7565499 (patch) | |
tree | 9a99518d868af17e5c82ee892f0fde65cf361da5 /src/symbol_table.h | |
parent | 628b18fb15ee3d6633c73d404f109d01f0a7ece2 (diff) | |
download | tpc-compiler-b8f7e7b6843c2bff778ce3c74e355a03e7565499.tar.gz |
Functions tables + void functions working (need to work on returns and parameters cause all functions are void here)
Diffstat (limited to 'src/symbol_table.h')
-rw-r--r-- | src/symbol_table.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/symbol_table.h b/src/symbol_table.h index fe0e35c..917e4f9 100644 --- a/src/symbol_table.h +++ b/src/symbol_table.h | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #define MAXNAME 32 | 13 | #define MAXNAME 32 |
14 | #define MAXSYMBOLS 256 | 14 | #define MAXSYMBOLS 256 |
15 | #define MAXFUNCTIONS 256 | ||
15 | 16 | ||
16 | typedef enum type { | 17 | typedef enum type { |
17 | INT, | 18 | INT, |
@@ -30,6 +31,21 @@ typedef struct { | |||
30 | int size; | 31 | int size; |
31 | } SymbolTable; | 32 | } SymbolTable; |
32 | 33 | ||
34 | typedef struct { | ||
35 | char name[MAXNAME]; | ||
36 | int return_type; | ||
37 | int nb_parameters; | ||
38 | } FTentry; | ||
39 | |||
40 | typedef struct { | ||
41 | FTentry entries[MAXFUNCTIONS]; | ||
42 | int maxsize; | ||
43 | int size; | ||
44 | } FunctionTable; | ||
45 | |||
46 | void fun_add(const char name[], int rt_type, int nb_par); | ||
47 | void fun_display_table(); | ||
48 | int fun_lookup(const char name[], int nb_param); | ||
33 | void glo_addVar(const char name[], int type); | 49 | void glo_addVar(const char name[], int type); |
34 | int glo_lookup(const char name[]); | 50 | int glo_lookup(const char name[]); |
35 | int glo_get_addr(const char name[]); | 51 | int glo_get_addr(const char name[]); |