Re: Pre-parser phase

Stefan Seefeld <[email protected]> Tue, 01 May 2007 13:49:23 -0400
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
Hi Gilles,

Gilles J. Seguin wrote:
> Hi stefan,
> 
> A thing that has never be mention or discuss,
> 
> we have a file
> we have preprocessing
> - perform file inclusion
> - and macro substitution
> result is sequence of tokens that is translation unit.
> 
> Question is,
> The Gnu gcc put identifier in symbol table
> during that preprocessing stage, right ?

I don't think so.

> We get them during parsing of the translation unit.
> Do you perceive any problems or reasons who will obliged us
> to do it that way.

No. The preprocessed file has to be valid C / C++ / whatever.

> One of them, result of concatenation operator(##) should return
> a valid token.
> And a valid token could be an identifier that at this point could
> be valid or not.
> 
> ex
> A ## :: should fail
> :: ## A should succeed
> A ## :: ## B ## :: ## C should succeed

All of them should fail. As you said above, '##' is a concatenation
operator that results in two tokens to be concatenated into one.
However, none of the above concatenation results is a valid C / C++ token.

> if previous A, B and C identifier have been declared
> and fail otherwise

Token concatenation happens on a syntactic level. There is no symbol lookup
going on, i.e. it doesn't matter whether any of the involved tokens (what you
call 'identifier') has been declared at that point.

Hartmut may explain all that much better, I guess. He has written most of
the Cpp processor, i.e. boost.wave.

> major implication on the parser.

None of the above involves the C++ parser.

Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...