On 4/26/07, Russ Cox <[EMAIL PROTECTED]> wrote:
> where is it determined that LNAME is returned when *t is scanned
> rather than LTYPE (the way it is returned in the declaration of foo)?
grep shows that /sys/src/cmd/cc/lex.c is relevant,
since it contains … the relevant bit of lexing.
you could trace back and see how s->class gets set.
I've done that; I've traced through the code for two weeks now. As
best as I can determine, s->class is set in the various dcl functions
in dcl.c. And I still can't find how any sort of scope overiding is
done.
In my compilers class, the professor suggested using some linked list
of scopes so that lookup would always return the nearest symbol by a
given name (modulo namespace issues). Since there's a single global
symbol table in kencc, what tells lookup to return the properly scoped
symbol?
Is there anyone active on 9fans that can give me a "bird's eye view"
of kencc's internal structures? I've read Johnson's "A Tour Through
the Portable C Compiler" in the v7 manual, and I'd guess that kencc
does something similar to pcc as described in the "Symbol Table
Maintenance" section -- I just don't find it in the code.
--Joel