[comp.lang.c] Preprocessor output and relaxed grammar

cspw@alpha.cs.ru.ac.za (Pete Wentworth) (03/22/91)

We want to transform some ANSI-C code after it has been preprocessed,
but before 'real' compilation.  But our initial tests have shown that
the code coming out of the preprocessors is not all that standard. 
For example, Turbo C has extra 'cdecl' and 'pascal' modifiers in its
syntax for procedure declarations. 

Are there many variations and dialects of the stuff we will encounter
coming out of various vendor's preprocessors?

We can also try our transformations before preprocessing, under the
assumption that the included libraries are NOT available.  But here the
parsing problem seems even harder.  We need to gather semantic
information about the identifiers and their types.  Assuming that this
information does not depend on any included libraries, does anyone
have a "relaxed" C grammar that can parse un-preprocessed C, and
ignore those things that it cannot understand because of the missing
library definitions?  Is it possible to give an LALR definition that
can parse an ANSI-C program in the absence of libraries?

Pete
--
EP Wentworth - Dept. of Computer Science - Rhodes University - Grahamstown.
cspw@alpha.ru.ac.za