From: | noitalmost <noitalmost@cox.net> |
Newsgroups: | comp.compilers |
Date: | Wed, 29 Jun 2011 13:13:32 -0400 |
Organization: | Compilers Central |
References: | 11-06-037 11-06-046 11-06-047 |
Keywords: | symbols, storage |
Posted-Date: | 29 Jun 2011 14:04:20 EDT |
On Saturday, June 25, 2011 06:55:06 am Hans-Peter Diettrich wrote:
> IMO qualifiers should allow to address identifiers in *external* (here:
> outer) scopes, which otherwise would be hidden by a local identifier of
> the same name.
For my language, this is my intention.
> A more elaborate example:
>
> program P;
> var P;
> var x;
> procedure P;
> var P: RecordContainingX;
> var x;
> procedure P;
> var x;
> ... P.x ...
> ... P.P.x ...
> end; //inner P
> ... P.x ... //x in var P or in outer procedure P?
# should be x in the record var P
> ... P() ... //recursive or local procedure call?
# local call
My language's scopes for this program would have the following symbols:
global scope:
P # the program
program P's scope:
P, x # variables
P # procedure
procedure P's scope:
P # record containing x
x
P # procedure
inner procedure P's scope:
x
Thanks for this example. It has helped me to consider some additional cases. I
never thought about the recursive vs. local call of P() in the above.
I'm parsing the dots left to right, which seems like it will give the results
I desire.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.