scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 4858c0d0e802307875e8fe191a52946f05f7907d
parent 242f9e6a3592eff25aa71efec50442dde00a71f9
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 24 Mar 2014 21:30:54 +0100

Add id field to symbol structure

This field will e used to generate the name of the variable in the intermediate
code.

Diffstat:
Msymbol.c | 2++
Msymbol.h | 1+
2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/symbol.c b/symbol.c @@ -85,6 +85,7 @@ install(char *s, uint8_t ns) register struct symbol *sym; register struct symbol **t; struct symtab *tbl; + static short id; if (ns == NS_KEYWORD) ns = NS_IDEN; @@ -96,6 +97,7 @@ install(char *s, uint8_t ns) sym->ctx = curctx; sym->token = IDEN; sym->ns = ns; + sym->id = id++; tbl = &symtab[(ns >= NR_NAMESPACES) ? NS_IDEN : ns]; sym->next = tbl->head; tbl->head = sym; diff --git a/symbol.h b/symbol.h @@ -57,6 +57,7 @@ union value { struct symbol { char *name; struct ctype *type; + short id; uint8_t ctx; uint8_t token; uint8_t ns;