intern symbols using hash table

This commit is contained in:
Yuichi Nishiwaki
2013-10-20 14:05:48 +09:00
parent bde09e063a
commit 7322271d65
5 changed files with 90 additions and 10 deletions
+1
View File
@@ -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
+2
View File
@@ -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;
+12
View File
@@ -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