|Comments & Code together? firstname.lastname@example.org (1996-06-08)|
|Re: Comments & Code together? email@example.com (Darius Blasbans) (1996-06-13)|
|Re: Comments & Code together? firstname.lastname@example.org (Andrew M. Bishop) (1996-06-13)|
|From:||Darius Blasbans <email@example.com>|
|Date:||13 Jun 1996 19:04:46 -0400|
|Organization:||PHIDANI Software, Bruxelles, Belgium|
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...
Return to the
Search the comp.compilers archives again.