Re: Comments & Code together?

Darius Blasbans <>
13 Jun 1996 19:04:46 -0400

          From comp.compilers

Related articles
Comments & Code together? (1996-06-08)
Re: Comments & Code together? (Darius Blasbans) (1996-06-13)
Re: Comments & Code together? (Andrew M. Bishop) (1996-06-13)
| List of all articles for this month |

From: Darius Blasbans <>
Newsgroups: comp.compilers
Date: 13 Jun 1996 19:04:46 -0400
Organization: PHIDANI Software, Bruxelles, Belgium
References: 96-06-037
Keywords: C, tools

Michael Hicks wrote:
> I am working on a program that will insert hypertext into .c files
> so that function calls will be "linked" to their definitions. To use one
> of the yacc C grammars floating around requires that the .c file be
> preprocessed first, thus eliminating all comments, #define's, etc., which
> is undesirable. Are there any C grammars out there that allow for
> preprocessing AND compilation to go on simultaneously? If not, does
> anyone have any suggestions as to how I could preprocess the file, parse
> it to insert hypertext links, and then reintroduce the missing comments,
> #define's, etc.?

We used a relatively brute force technique a few years ago, which
used the standard C preprocessor to produce "pure" C, using the
#line directives to match the original C source code and the
preprocessed text. Whenever a construct is parsed, its original
line number is pretty easy to determine, and if the matching
happens to be performed based on an identifier (the function
name), it is pretty straightforward to find the true original place
with a reasonable level of precision..

I can find the source back, if you want...



Post a followup to this message

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