8

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.

codenheim
  • 20,467
  • 1
  • 59
  • 80
  • 1
    Why not ANLTR? IMO it works well on Windows. – kenny Mar 13 '10 at 21:30
  • Mainly because I didn't want to port my grammar from Yacc/Bison to ANTLR. Nothing against ANTLR, I've played with it, but never "adopted" it. I work on my compiler in my spare time, as a hobby, and any porting to a different dialect might tie up several weekends. – codenheim Mar 13 '10 at 22:27
  • So you're asking for a tool that does the exact same thing as flex + bison, but refuse to accept any syntax changes from flex/bison? Why not just stick with what you're using then? – Billy ONeal Mar 14 '10 at 00:23
  • What's the matter with modern bison? v2.4.1? http://www.gnu.org/software/bison/manual/bison.html – Ira Baxter Mar 14 '10 at 01:20
  • @Ira Baxter: I'm using 2.4 on Linux. Does 2.4.1 compile and run on Windows now without any Cygwin dependency? If so, I missed that. I'll do the research. This was really a question of keeping up the most currently developed Yacc/Bison codebase, not about needing a new generator. Thanks. – codenheim Mar 14 '10 at 03:39
  • @mrjoltcola: No, I guess I wasn't paying close enough attention to the "no cygwin" part. We use the cygwin stuff so thoughtlessly under Windows that I almost forget it is there; havent' checked Bison to see if it does. – Ira Baxter Mar 14 '10 at 07:36
  • 1
    After experimenting with ANTLR, bison and yacc, I've come to the conclusion, that it's best to write your own lexer/parser pair. – user1095108 Oct 24 '14 at 08:03

2 Answers2

2

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.

SK-logic
  • 9,605
  • 1
  • 23
  • 35
1

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

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • 3
    @mrjoltcola: ANTLR has a C target and is completely usable in C++. There's no separate C++ target because it would be redundant -- most of the C components are only used by ANTLR itself. You can use C++ in the semantic actions as much as you like. – Billy ONeal Mar 14 '10 at 05:31
  • Ok, +1 to your followup as it is helpful. – codenheim Mar 14 '10 at 13:12