Re: C++ Class wrapper for yacc

dancho@enuxsa.eas.asu.edu (Mark Dancho )
20 Jul 1996 21:40:56 -0400

          From comp.compilers

Related articles
Down to three tools... inpact5@clr34el.der.edf.fr (INPACT5 inpact5) (1996-07-05)
Re: Down to three tools... noble@utmc.utc.com (Troy Noble) (1996-07-13)
C++ Class wrapper for yacc vgore@ix.netcom.com (1996-07-18)
Re: C++ Class wrapper for yacc scooter@mccabe.com (Scott Stanchfield) (1996-07-20)
Re: C++ Class wrapper for yacc dancho@enuxsa.eas.asu.edu (1996-07-20)
| List of all articles for this month |

From: dancho@enuxsa.eas.asu.edu (Mark Dancho )
Newsgroups: comp.compilers
Followup-To: comp.compilers
Date: 20 Jul 1996 21:40:56 -0400
Organization: Arizona State University
References: 96-07-048 96-07-088 96-07-118
Keywords: C++, yacc

Vipul Gore (vgore@ix.netcom.com) wrote:
: Is there a C++ Class wrapper for yacc like flex++ (FlexLexer.h)?
: Any pointer is appreciated?


I don't know of any pre-existing wrappers available. I wrote my own
class wrapper by using Bison's reentrant option and defining yyparse to
ParserClass::YYParse.


      %pure_parser
      #define yyparse ParserClass::YYParse


The pound define is a bit of a kludge, but it works. After doing these
steps, you can define your parser class as you see fit, and bison will
produce the code for the function YYParse. I define the parser class to
contain a private instance of my lexer class.


I hope this helps.
--
Mark Dancho
Dancho@asu.edu
--


Post a followup to this message

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