Re: C Language Scoping

Hugo Branco Venancio <>
29 Oct 1997 23:09:53 -0500

          From comp.compilers

Related articles
C Language Scoping (Gilberto Persico) (1997-10-26)
Re: C Language Scoping (Michael S. Schliephake) (1997-10-29)
Re: C Language Scoping (Hugo Branco Venancio) (1997-10-29)
| List of all articles for this month |

From: Hugo Branco Venancio <>
Newsgroups: comp.compilers
Date: 29 Oct 1997 23:09:53 -0500
Organization: Instituto Superior Tecnico
References: 97-10-118
Keywords: C, parse, symbols

Gilberto Persico wrote:

> how can a symbol be assigned to a scope (global, a function, a structure)
> during
> parsing ??? And if I have the same symbol used in more contexts like the
> following example:
> struct A
> {
> int x;
> int y;
> };
> void test()
> {
> float x;
> }
> how can I know in the parser that the first X is an int in scope A and
> the second X is a float in scope test ?? I can discover that the first x

You must always keep your current scope when you are parsing. In this
example, when the parser is in function teste(), your current scope is
different from the global scope, right? So, if you have one symbol
table per scope, your know that second variable x (float) bellongs to
a different symbol table than the first one.


Post a followup to this message

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