From: george AT george DOT org (Babylon7) Newsgroups: comp.os.msdos.djgpp Subject: Re: HELP: Bison, Flex & C++ class support... Date: Fri, 18 Apr 1997 03:13:32 GMT Organization: Erol's Internet Services Lines: 34 Message-ID: <335be6d9.25865240@news.erols.com> References: NNTP-Posting-Host: spg-as25s25.erols.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 17 Apr 1997 13:42:53 GMT, Eli Zaretskii wrote: > > >On Thu, 17 Apr 1997, Programmed to death wrote: > >> I want to be able use c++ classes in both the lexer and the parser, >> and possibly pass objects of a particular class back and forth between >> the two. > >Caveat: I have never used flex with C++, so the advice below might be >nothing but a wild goose. > >What version of flex did you use? The latest port of flex 2.5.4 >(v2gnu/flx254b.zip) comes with a program flexpp.exe that should be used >for creating C++ lexers. A header file FlexLexer.h should also be used >in C++ lexers. I believe this is all explained in the flex docs. I am using Flex 2.5.2, Bison 1.24, and gcc v2.7.2.1. I took a look at FlexLexer Scanner class, it looks interesting but i haven't heard about anyone swearing by it yet. I am trying to keep the whole project compilable using gcc, lex, and yacc. So i would rather not delve into the Flex scanner Class right now. I have the yacc compatiblity option on in Bison and am trying to keep to standard lex. Everyone should have gcc though... so I will use c++ freely where it doesn't get in the way of lex and yacc compatibility. By the way, Chris Croughton's suggestions worked... I have uploaded the fixed code in reply to his post. Programming the fun way