aboutsummaryrefslogtreecommitdiff
path: root/src/symbol_table.h
diff options
context:
space:
mode:
authorpacien2018-06-05 22:41:15 +0200
committerpacien2018-06-05 22:41:15 +0200
commit0f4b1600983f8afda41a02fec07424338785d81d (patch)
treecd1a3b2f599f7242c9fe76f9d66ca95ba58e34c0 /src/symbol_table.h
parent864653f00dff0a8a1f37d8e9a732c1da8309a930 (diff)
downloadtpc-compiler-0f4b1600983f8afda41a02fec07424338785d81d.tar.gz
Prevent assigning to const
Diffstat (limited to 'src/symbol_table.h')
-rw-r--r--src/symbol_table.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/symbol_table.h b/src/symbol_table.h
index b2c8879..23cd618 100644
--- a/src/symbol_table.h
+++ b/src/symbol_table.h
@@ -15,6 +15,11 @@
15#define MAXSYMBOLS 256 15#define MAXSYMBOLS 256
16#define MAXFUNCTIONS 256 16#define MAXFUNCTIONS 256
17 17
18typedef enum scope {
19 GLOBAL,
20 LOCAL
21} Scope;
22
18typedef enum type { 23typedef enum type {
19 INT, 24 INT,
20 CHAR, 25 CHAR,
@@ -54,12 +59,15 @@ void glo_addConst(const char name[]);
54int glo_lookup(const char name[]); 59int glo_lookup(const char name[]);
55int glo_get_addr(const char name[]); 60int glo_get_addr(const char name[]);
56void glo_display_table(); 61void glo_display_table();
62
57void loc_addVar(const char name[], int type); 63void loc_addVar(const char name[], int type);
58void loc_addConst(const char name[]); 64void loc_addConst(const char name[]);
59int loc_lookup(const char name[]); 65int loc_lookup(const char name[]);
60int loc_get_addr(const char name[]); 66int loc_get_addr(const char name[]);
61void loc_display_table(); 67void loc_display_table();
62void loc_clean_table(); 68void loc_clean_table();
69
63void check_expected_type(int type_to_check, int type_expected); 70void check_expected_type(int type_to_check, int type_expected);
71bool is_read_only(const char name[], Scope scope);
64 72
65#endif 73#endif