Related articles |
---|
flex++/bison++ sample source biswas@tti.com (Subhabrata Biswas) (1998-02-14) |
Re: flex++/bison++ sample source acoetmeur@icdc.caissedesdepots.fr (Alain Coetmeur) (1998-02-18) |
Re: flex++/bison++ sample source steinars@ii.uib.no (Steinar S|reide) (1998-02-18) |
From: | Steinar S|reide <steinars@ii.uib.no> |
Newsgroups: | comp.compilers |
Date: | 18 Feb 1998 23:02:50 -0500 |
Organization: | Compilers Central |
References: | 98-02-063 |
Keywords: | yacc, lex, C++ |
> I just couldn't figure out how to use the scanner and parser classes
> generated by flex++ and bison++. How do you tell the parser class
> which scanner to use ?
You must create a subclass of the generated parser class. The
derived class inherits the (virtual) function yylex(). You should
redefine this function to call the yylex function of your scanner,
which suitably can be a data member of your derived class.
Examples of this are included in the misc-package accompanying the tools.
Optional parameters to the function can be defined using the predefined
macros. See examples and documentation for how this is done.
Works great!
-Steinar S=F8reide
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.