[prev in list] [next in list] [prev in thread] [next in thread]
List: pcc-list
Subject: Re: Symbol table implementation in PCC
From: Anders Magnusson <ragge () ludd ! ltu ! se>
Date: 2010-06-03 9:09:39
Message-ID: 4C077153.2000808 () ludd ! ltu ! se
[Download RAW message or body]
Hi again Tony,
a hint is to subscribe to the mailing list so that I don't have to
approve all mails you send :-)
Tony Cui wrote:
> > Anders Magnusson <ragge <at> ludd.ltu.se> writes:
> >
> >
> > Hi Anders,
> > I feel really lucky that I find you here over the internet!! Your comments is
> > very useful to me, and I have solved that problem within 6 hours. I will
> > certainly keep posting interesting questions here, as I move further with PCC
> > compiler.
> > Here comes one:
> > (you mentioned in your reply..)
> >
> >
>
>>> >>> The local variables are stored in temporary memory that is free'd when
>>> >>> the function is parsed.
>>> >>>
>>>
>> >>
>> >>
>>
> > I did not really get this part.
> > Do you mean that symbol table information for variables local to a function
> > (perhaps parameters included?) are deleted after the current function is parsed,
> > so these information can not be accessed later?
>
Exactly. It's even more exciting; the information about local variables
are removed as soon
as the block it was declared in is ended. For example:
x() {
int a;
{
int b;
....
} <- Here is b free'd and forgotten.
} <- Here is a forgotten.
> > If that is what happened, would
> > the compiler need these symbol table information (e.g. local variables) later
> > for code generation and code optimization?
> > Thanks again..
> >
>
The variables are converted to an internal representation when they are
found. In the above
example both a and b would be TEMP nodes with correct type and
individual numbers, which
is everything needed for next pass.
-- Ragge
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic