Integrating C preprocessor with the parser

map@cadillac.siemens.com
12 Mar 90 16:50:58 GMT

          From comp.compilers

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)
| List of all articles for this month |

From: map@cadillac.siemens.com
Newsgroups: comp.compilers
Date: 12 Mar 90 16:50:58 GMT
Organization: Siemens Corporate Research
Keywords: C,parse

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.


Program databases in these tools should ideally contain all of the original
information found in the program text in order to present complete structural
information to a programmer. In many of these environments, the syntax and
semantics of programs are commonly represented with attributed abstract
syntax trees. AST's are easy to generate and manipulate and conveniently
reflect the structure of the programs they represent. However, for the case
of C, AST's are not sufficient. The C preprocessor, which provides
conditional compilation and macro substitution, supports features that cannot
easily be described by a tree-structure.


I am looking for references to work on this subject. How have people handled
the multiple versions of an AST induced by conditional compilation
directives? Parsing these structures and representing them causes many
problems. Since macro bodies and macro arguments are not required to be
syntactically complete, they also create parsing and representation problems.
Any references or experiences would be extremely helpful.


Thanks for your help.
--
Michael Platoff email: map@cadillac.siemens.com
Siemens Corporate Research phone: (609) 734-3354
755 College Road East
Princeton, NJ 08540-6668





Post a followup to this message

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