Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LALR(1) or GLR on Windows - Alternatives to Bison++ / Flex++ that are current?

UPDATE: This question is out of date, but left for informational purposes.

Original Question

I have been using the same version of bison++ (1.21-8) and flex++ (2.3.8-7) since 2002.

I'm not looking for an alternative to LALR(1) or GLR at this time, just looking for the most current options. Is anyone aware of any later ports of these than the original that aren't Cygwin dependent?

What are other folks using in Windows environments for C++ compiler development (besides ANTLR or Boost.spirit)? Commercial options are ok, if you have firsthand experience. I do need to compile on Linux as well.

UPDATE: This old question was asked when I wasn't aware of the policies about tool recommendations (not sure if policy existed in 2010 but regardless...

I since updated to Bison 3.0 which has GLR capabilities and have begun experimenting with that.

I eventually decided that any rewrite of my parser would be a recursive descent, to improve error reporting and allow easier use in tools besides the compiler, so for now I will complete the reference version in Bison. I see little point in converting to a different PG tool at this time.

like image 945
codenheim Avatar asked Mar 13 '10 21:03

codenheim


People also ask

What is bison in compiler design?

Bison is a general-purpose parser generator that converts an annotated context-free grammar into a deterministic LR or generalized LR (GLR) parser employing LALR (1) parser tables. As an experimental feature, Bison can also generate IELR (1) or canonical LR(1) parser tables.

Does GCC use Lex and Yacc?

Are all Parsers made with yacc or bison (and lex/flex)? No. For example, GCC don't use them.


2 Answers

You can try Elsa (now it is a part of Oink project). But it is almost dead now. The only attractive feature of it is that there is a complete and robust C and C++ parser is written on top of it.

LLVM contains a reasonably modern parsing framework. And there is a C++ parser as well (see clang project).

Some Packrat implementations for C++ are available, sort of the most trendy thing in parsing.

like image 193
SK-logic Avatar answered Sep 21 '22 06:09

SK-logic


I like ANTLR a lot. Boost Spirit is a bit "out there" for serious production applications.

like image 45
John Zwinck Avatar answered Sep 21 '22 06:09

John Zwinck