Re: [9fans] scopes in kencc - Plan9

This is a discussion on Re: [9fans] scopes in kencc - Plan9 ; > 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: [9fans] scopes in kencc

  1. Re: [9fans] scopes in kencc

    > 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


  2. Re: [9fans] scopes in kencc

    On 4/26/07, Russ Cox wrote:
    > look for push1 and revertdcl.


    Thanks.
    --Joel

+ Reply to Thread