Re: Symbol tables and scopes

Hans-Peter Diettrich <DrDiettrich@compuserve.de>
6 Feb 2006 00:06:31 -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)
Re: Symbol tables and scopes cfc@shell01.TheWorld.com (Chris F Clark) (2006-02-11)
Re: Symbol tables and scopes cbarron413@adelphia.net (Carl Barron) (2006-02-12)
[12 later articles]
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich@compuserve.de>
Newsgroups: comp.compilers
Date: 6 Feb 2006 00:06:31 -0500
Organization: Compilers Central
References: 06-01-101 06-02-027
Keywords: symbols
Posted-Date: 06 Feb 2006 00:06:31 EST

Peter Flass 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.


How exactly do you find the block with the "applicable" definition, in
an tree of scopes/blocks?


It looks like inefficient to me, when for every currently visible scope
the block id must be compared with the id's of *all* possible blocks?


DoDi



Post a followup to this message

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