[comp.lang.c++] Lex/Yacc of C++ -- or even BNF

pgh@stl.stc.co.uk (Peter Hamer) (07/25/89)

I too would very much like a Lex/Yacc grammar of C++.

BUT, failing this, I would welcome pointers to reasonably precise descriptions
of the C++ grammar and/or or its differences from that of C. Obviously I would
also appreciate warnings about over-simplified grammars [cf K&R for C :-)].

The only information I have on the C++ grammar at the moment is in Stroustrup's
book (July 87 reprint).

BTW for anybody intending to develop lex/yacc for C++.
 1) I believe that the best source for a C grammar is Harbison & Steele.
 2) A little while back somebody posted a lex/yacc grammar for (ANSA?) C to
    this group.


Has anyone considered starting with the gnu C++ compiler, and doing one of the
following?

 1) Reverse-engineering the grammar.
 2) Modifying the parser to produce the required output.
 3) Using the parser as-is and manipulating (or unparsing) the syntax tree to
    produce the required output.

Peter