Related articles |
---|
[2 earlier articles] |
Re: Number of compiler passes gneuner2@comcast.net (George Neuner) (2008-07-21) |
Re: Number of compiler passes m.helvensteijn@gmail.com (Michiel) (2008-07-22) |
Re: Number of compiler passes dwashington@gmx.net (Denis Washington) (2008-07-25) |
Re: Number of compiler passes m.helvensteijn@gmail.com (Michiel) (2008-07-25) |
Re: Number of compiler passes gneuner2/@/comcast.net (George Neuner) (2008-07-25) |
Re: Number of compiler passes m.helvensteijn@gmail.com (Michiel) (2008-07-26) |
Re: Number of compiler passes gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-07-27) |
Re: Number of compiler passes gneuner2@comcast.net (George Neuner) (2008-07-28) |
Re: Number of compiler passes gneuner2@comcast.net (George Neuner) (2008-07-28) |
Re: Number of compiler passes gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-07-29) |
Re: Number of compiler passes gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-07-29) |
Re: Number of compiler passes m.helvensteijn@gmail.com (Michiel) (2008-07-29) |
Re: Number of compiler passes m.helvensteijn@gmail.com (Michiel) (2008-07-29) |
[4 later articles] |
From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | Sun, 27 Jul 2008 19:06:28 -0800 |
Organization: | Compilers Central |
References: | 08-07-041 08-07-044 08-07-048 08-07-058 |
Keywords: | design, symbols |
Posted-Date: | 28 Jul 2008 09:48:01 EDT |
George Neuner wrote:
(snip)
> As long as non-local variables are transitively in the lexical scope
> chain of the function that uses them you can still gather all the
> declarations in one pass. If they're not, you have a language that
> will be error prone and confusing to use.
> The simplest way to do it is to organize your symbol "table" as a
> stack of lists[*]. You attach a local symbol list to each function's
> definition node in the AST.
I think that is fine, but some languages and language features
complicate the problem.
One interesting feature (though some might disagree on
whether it really is a feature) is partial qualification
for structure references in PL/I.
Referencing a variable in a structure only needs enough
qualification to be unambiguous. It gets more interesting
with nested scope when a name could agree with partial
qualification at more than one level. I believe it works
such that, given the stack of lists as you indicate, you can
go up the list and take the first one that agrees, within
partial qualification, with the given symbol.
That makes it relatively easy for compilers, and means
that a change at a higher level of nesting won't change
the meaning of a name at a lower level.
-- glen
Return to the
comp.compilers page.
Search the
comp.compilers archives again.