aboutsummaryrefslogtreecommitdiff
path: root/src/symbol_table.h
diff options
context:
space:
mode:
authorAdam NAILI2018-06-03 15:30:53 +0200
committerAdam NAILI2018-06-03 15:30:53 +0200
commitb8f7e7b6843c2bff778ce3c74e355a03e7565499 (patch)
tree9a99518d868af17e5c82ee892f0fde65cf361da5 /src/symbol_table.h
parent628b18fb15ee3d6633c73d404f109d01f0a7ece2 (diff)
downloadtpc-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.h16
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
16typedef enum type { 17typedef enum type {
17 INT, 18 INT,
@@ -30,6 +31,21 @@ typedef struct {
30 int size; 31 int size;
31} SymbolTable; 32} SymbolTable;
32 33
34typedef struct {
35 char name[MAXNAME];
36 int return_type;
37 int nb_parameters;
38} FTentry;
39
40typedef struct {
41 FTentry entries[MAXFUNCTIONS];
42 int maxsize;
43 int size;
44} FunctionTable;
45
46void fun_add(const char name[], int rt_type, int nb_par);
47void fun_display_table();
48int fun_lookup(const char name[], int nb_param);
33void glo_addVar(const char name[], int type); 49void glo_addVar(const char name[], int type);
34int glo_lookup(const char name[]); 50int glo_lookup(const char name[]);
35int glo_get_addr(const char name[]); 51int glo_get_addr(const char name[]);