Eric Sosman <Eric.Sosman@sun.comwrites:
Quote:
Walter Roberson wrote On 09/26/07 10:07,:
[...]
Quote:
Quote:
>Summary:
> You cannot remove comments from source without something approaching
> the power of the preprocessor, with complete knowledge of the
> defines in effect.
>
False. The preprocessor has no knowledge of comments,
no influence on comments, and nothing to do with comments.
You need only a lexical analyzer; no knowledge or processing
of macros is required or desired.
I agree with your conclusion, but not necessarily with your statement
that the preprocessor has no knowledge of comments.
The standard defines 8 translation phases. Comments are replaced by
space characters in phase 3; preprocessing directives are executed and
macros are expanded in phase 4. But the standard doesn't define what
"the preprocessor" is. In an implementation which has a distinct
"preprocessor" component, perhaps a separate program, that program
could handle phases 1 through 4, or 1 through 5, or even 1 through 6.
(See C99 5.1.1.2 for the descriptions of the translation phases.)
--
Keith Thompson (The_Other_Keith)
kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"