|bison, flex and c++ email@example.com (Shashank G. Khandelwal) (2002-10-18)|
|Re: bison, flex and c++ firstname.lastname@example.org (Jan Kleinsorge) (2002-10-20)|
|Re: bison, flex and c++ email@example.com (Chris Hundhausen) (2002-10-20)|
|Re: bison, flex and c++ pioter@terramail.CUTTHIS.pl (Piotr Zgorecki) (2002-10-20)|
|Re: bison, flex and c++ firstname.lastname@example.org (Graham Douglas) (2002-10-25)|
|Re: bison, flex and c++ email@example.com (Dave Sieber) (2002-11-06)|
|From:||"Dave Sieber" <firstname.lastname@example.org>|
|Date:||6 Nov 2002 11:41:01 -0500|
|Keywords:||Windows, lex, yacc, C++|
|Posted-Date:||06 Nov 2002 11:41:01 EST|
"Graham Douglas" <email@example.com> wrote in news:02-10-117
> IF you use Windows, try here
I can vouch for this, it's a very good package. I've been testing it for
the last week or so, generating lexers & parsers in C++ that support
Unicode (using their recently released version 2.0). It all works very
well (except for my difficulties with yacc itself :-).
If you want to use it with the latest MS compiler (VC7.0) there are a
couple of configuration issues when you build the libraries, because MS
has changed their directory layouts for include and library files. But it
is straightforward to either adapt the Bumble-Bee build scripts or to
rearrange your local directory structures (the approach I took).
I've used only the C++ option, I have not tried generating parsers in C
or Java. Their C++ integration is straightforward. Lexers and parsers are
classes, derived from an abstract base class, generated from your .l and
..y files. There are virtual methods you can override for I/O (iostream-
based for C++), and of course you can add your own methods and members.
Lexers and parsers carry pointer reference to each other, so there are no
globals, which means you can create multiple instances of them as needed.
They compiled and ran perfectly in my host app the first time.
They have a Wizard that will generate skeletons for you, and you just add
your token definitions, rules, etc. I'd recommend doing it this way, as
they provide all the necessary sections and #include statements that
you'll need, as well as the basic class definitions for your
lexer/parser. You just select the type of parser you want (SLR, LALR,
CLR, Unicode or not) and they generates the base code. You also have the
option of creating DLLs or static libraries, and debug/release builds of
each type, which is very nice indeed. I created a series of #ifdef's in
my common header to link the correct version, using the "#pragma comment
(lib, xxx)" feature of Visual C++, which saves me the headache of trying
to remember the file names for the many library options they supply.
You can use your own editor/build environment, but they also supply their
own GUI-based "IDE". While it's not Visual Studio, it has all the basics
you need, including syntax highlighting on your lex/yacc files,
bookmarks, next/prev error, context-sensitive help on error messages,
build/rebuild commands, and more. There is also an external "Tools" menu
that you can add commands to -- I added Emacs to mine so that I can flip
over to Emacs when I get "itchy" in their IDE :-) (note: editing a .l or
..y file externally wipes out the bookmarks you've defined in the Bumble-
Bee IDE). The online help file covers everything on both lex and yacc,
and also covers all aspects of building, compiling, and linking with
their code. An improvement here would be an additional single-file HTML
or PDF version, as navigating the MS-Help structure is mildly tedious at
Ah yes, one option I'd like to see: the ability to generate enum's
instead of #define's for tokens, so that the debugger can display them
symbolically. But I have not (yet) needed to descend into a debugger on
It's all quite nice, and at $60 you can't beat it. I've used Bison, MKS,
and Abraxas (albeit some years ago), and Bumble-Bee's offering is IMO one
of the best as a complete package. There are really only two questions
you need to answer: 1) do you need/want a Windows solution, and 2) is
yacc the right technology for your project.
Return to the
Search the comp.compilers archives again.