heet@castor.usc.edu (Gerard Heet) (01/18/90)
Hi there !!! Can anyone mail me a grammar for C++ in YACC format ??? This will be used to check the syntax of C++ code. Thanks, Jerry Heet heet@castor.usc.edu
cs326ad@ux1.cso.uiuc.edu (01/19/90)
I would also be interested to know if there is even a YACC that outputs c++ format code (although it really can't differ much from C).. -Mark
rich@Rice.edu (Rich Murphey) (01/20/90)
Both bison and flex will work with g++.
If you want to use ostreams (cerr) for error messages you might want
to redefine ECHO and YY_FATAL_ERROR for flex:
#include <stream.h>
#undef ECHO
#define ECHO cerr << yytext
#undef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) { cerr << msg << '\n'; exit (1);}
#define input yyinput
I've offered some example code using bison, flex and libg++ to Doug
Lea, but haven't finished all the paperwork. I'll post a note when
it's ready.
--
Rich@rice.edu