Re: Symbol tables and scopes

Peter Flass <Peter_Flass@Yahoo.com>
3 Feb 2006 18:40:17 -0500

          From comp.compilers

Related articles
Symbol tables and scopes DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-01-28)
Re: Symbol tables and scopes david@tribble.com (David R Tribble) (2006-02-02)
Re: Symbol tables and scopes cfc@shell01.TheWorld.com (Chris F Clark) (2006-02-03)
Re: Symbol tables and scopes Peter_Flass@Yahoo.com (Peter Flass) (2006-02-03)
Re: Symbol tables and scopes gdr@integrable-solutions.net (Gabriel Dos Reis) (2006-02-06)
Re: Symbol tables and scopes DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-02-06)
Re: Symbol tables and scopes DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-02-06)
Re: Symbol tables and scopes gah@ugcs.caltech.edu (glen herrmannsfeldt) (2006-02-06)
Re: Symbol tables and scopes Peter_Flass@Yahoo.com (Peter Flass) (2006-02-07)
Re: Symbol tables and scopes alexc@TheWorld.com (Alex Colvin) (2006-02-11)
[14 later articles]
| List of all articles for this month |

From: Peter Flass <Peter_Flass@Yahoo.com>
Newsgroups: comp.compilers
Date: 3 Feb 2006 18:40:17 -0500
Organization: Road Runner
References: 06-01-101
Keywords: symbols
Posted-Date: 03 Feb 2006 18:40:17 EST

Hans-Peter Diettrich wrote:
>
> In an IDE instead a tree of scopes must be used, and a symbol must be
> searched in all scopes, from the current (innermost local) scope up to
> the global scope in the root of the tree. Any suggestions on the
> implementation of such a data structure, or should I stay with my
> existing approach, extended by a search through multiple symbol
> tables?


I can't lay any claim to originality, but I use a two-layer structure.
I have one "base" entry for a unque symbol (name). The "base" entry
contains a list of pointers to the actual symbol table entries, one for
each declaration, and the id of the block containing the declaration. I
look up the symbol and then scan the list to find the applicable
declaration for the current scope.



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.