intern symbols using hash table
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#define PIC_STACK_SIZE 1024
|
||||
#define PIC_IREP_SIZE 256
|
||||
#define PIC_GLOBALS_SIZE 1024
|
||||
#define PIC_SYM_TBL_SIZE 128
|
||||
|
||||
/* enable all debug flags */
|
||||
#define DEBUG 1
|
||||
|
||||
@@ -27,6 +27,8 @@ typedef struct {
|
||||
pic_value sADD, sSUB, sMUL, sDIV;
|
||||
struct pic_env *global_env;
|
||||
|
||||
struct sym_tbl *sym_tbl;
|
||||
|
||||
pic_value *globals;
|
||||
size_t glen, gcapa;
|
||||
struct pic_irep **irep;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef SYMBOL_H__
|
||||
#define SYMBOL_H__
|
||||
|
||||
struct sym_tbl {
|
||||
pic_value tbl[PIC_SYM_TBL_SIZE];
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct sym_tbl * sym_tbl_new();
|
||||
pic_value sym_tbl_get(struct sym_tbl *, const char *);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user