-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTODO
41 lines (32 loc) · 1.39 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
the 'signed' keyword is an abomination added by ansi. fuck 'em.
anonymous enums do what exactly? right now, they break.
verify that nested macros work.
#define FOO(x,y) bar(x,y)
#define XYZZY(a,b) FOO(a,FOO(b,a))
to maybe to shrink the lexer a bit
make a bitmap with 128 entries:
0x01 - is a character that may start a symbol name
0x02 - is a character internal to a symbol name
0x04 - is whitespace
0x10 - is an operator
0x20 - is an += kind of operator
0x40 - is an ++ kind of operator
single bit bitfields in a struct should be efficient ways to handle flags.
for example, symbol visibility: if (sym->visible) { emit("extern "); }:
ld iy, sym ; bit 4, (iy+9) ; jr foo
faster/smaller, new scope/symbol space management:
symbols are stored in an array, and are marked not by a pointer, but by a index.
index 0 is the first global, which grows up. locals are negative, and grow down.
each symbol has a scope level. when a block is opened, the level is incremented,
and when the block is closed, the level is decremented.
lookups start from the most recent local and go to the last global.
names are stored as fixed length strings, and start with a hash, length, and data.
only N (12? 10?) bytes of name data are stored, in an attempt to get the symbol
table down to 16 bytes.
statics are global in storage, but lexica
struct symbol {
char hash;
char length;
char name[NAMELEN];
type_t *type;
char level;