|Preprocessor suggestions email@example.com (2001-09-16)|
|Re: Preprocessor suggestions firstname.lastname@example.org (2001-09-20)|
|Re: Preprocessor suggestions Olivier.Ridoux@irisa.fr (Olivier Ridoux) (2001-09-20)|
|Date:||16 Sep 2001 00:34:12 -0400|
|Posted-Date:||16 Sep 2001 00:34:12 EDT|
I'd like to start a translator program from C to a much less
expressive language. My first step would be to modify the c
preprocessor so that it doesnt swallow up the comments. Anyone see a
problem with trying to do this. This will be a first for me so I don't
have any insight into potential pitfalls.
Can you treat a comment as though it were a token?
Also in reading the Fraser & Hanson's Retargetable compiler book, the
preprocessor is almost non-existent. Does the preprocessor handle
trigraphs? Is it ANSI compliant or would it be pre-ANSI?
Novice at the wheel.
[Leaving comments in the preprocessed code is easy enough, but keeping
comments in a parser is surprisingly tricky. My usual advice is to
have a comment field on each token structure and hang comment text on
the preceding or following token. -John]
Return to the
Search the comp.compilers archives again.