> 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?

only the properly scoped symbol is in the hash table
during the lookup.  new declarations replace old ones
but the old ones get added to an undo log.  when a } is
reached, the undo log is applied to put the old ones back.
this is a very common "implicit" representation of the scope.
appel's book, at least, discusses it as an alternative
to the linked-list-of-scopes approach.

look for push1 and revertdcl.

russ

Reply via email to