[gnu.gcc] GNU grammar

becher@armada.UUCP (Jonathan D. Becher) (11/30/88)

A question for all you FSF types out there (or anyone else who cares to
answer).

I am interested in building a sophisticated preprocessor for C/C++ 
which expands the syntax of the base language.  I had hoped to be able 
to implement this preprocessor by adding my own grammar rules to the 
standard GNU lex/yacc with all of the productions (i.e. actions) removed.
In other words, the preprocessor would just recognize standard syntax
but would perform some transformations on the expanded constructs so
that the output would again be standard C/C++ that could be fed to an
unchanged compiler.

Although this seems like a good idea in principle, I have had a devil of
a time stripping the actions from the yacc as many of the actions seem
to effect the lexer.  My question is then this: Is there an easier way
to use GNU's grammar to recognize the language without actually building
the parse tree?

In THANKS Advance,
Jon Becher

argosy!becher@decwrl.dec.com          -OR-            becher@cs.duke.edu