Related articles |
---|
Integrating C preprocessor with the parser map@cadillac.siemens.com (1990-03-12) |
Integrating C preprocessor with the parser jml@wally.altair.fr (1990-03-14) |
Integrating C preprocessor with the parser peterson@Compass.COM (1990-03-19) |
Re: Integrating C preprocessor with the parser pgl@cup.portal.com (1990-03-15) |
Date: | Wed, 14 Mar 90 12:33:04 +0100 |
From: | jml@wally.altair.fr |
Posted-Date: | Wed, 14 Mar 90 12:33:04 +0100 |
Keywords: | C,parse |
Michael Platoff writes:
> One well-known shortcoming of the C programming language is
> the poor integration of its macro preprocessor with the C
> grammar. This presents many problems to C language tools
> such as structure editors, view-oriented program browsers,
> or program transformation tools that try to integrate the
> syntax and semantics of the preprocessor directives within
> the underlying program structure.
I am now writing an incremental compiler for the CO2
language, which is an object-oriented superset of C, and the
simplest way I have found to deal with this problem is to
index the source code by line number and use the
# <line> <file>
sequences inserted by most C preprocessors. The main
disadvantage of this is that the preprocessor has to be run
extensively on a compilation unit before the incremental
parser can be invoked. I guess some such way around can be
found in most cases, but I would also be interested in a
cleaner approach to the problem.
---
Jean-Marie Larcheveque email: jml@bdblues.altair.fr
Altair phone: (1) 39 63 52 18
BP 105
78153 Le Chesnay Cedex
France
[I've never seen a satisfactory solution to this problem either, or to the
related problem of pointing at the right place in the source where a syntax
error occurred. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.