Initial release of Goldie: GOLD Parser Engine for D

Nick Sabalausky a at a.a
Fri Aug 28 13:47:58 PDT 2009


"Grzegorz Adam Hankiewicz" <gradha at titanium.sabren.com> wrote in message 
news:h78ojv$duj$1 at digitalmars.com...
>
> I googled for GOLD vs ANTLR and only found a thread five years ago that 
> stated ANTLR was better if you wanted the full kitchen sink, and GOLD was 
> just a bunch of hacks.
>
> Has somebody a link to a more recent comparison or do I have to write my 
> own homework?

You're right, it does seem to be hard to find a good comparison of the two. 
Here's what I was able to find:

Another one a few years old:
http://www.antlr.org/pipermail/antlr-interest/2004-October/009730.html

Newer, but somewhat one-sided in favor of GOLD:
http://books.slashdot.org/comments.pl?sid=566251&cid=23579953

Includes a lot of other parser generators:
http://en.wikipedia.org/wiki/Comparison_of_parser_generators#Context-free_languages

I have only very limited experience with ANTLR, and I've spent much more 
time with GOLD (Which I personally prefer, as you can probably tell from the 
fact that I wrote a GOLD engine ;) ), but here's my best attempt at an 
accurate neutral comparison:

[Neutral?] - GOLD is LALR and ANTLR is LL(*) (For whatever that information 
is worth....You could probably find an LALR vs LL(*) comparison somewhere.)

[Pro ANTLR] - ANTLR is open-source and cross-platform (because it runs on 
the JVM). But, GOLD is only available on Windows (although it might work on 
wine, I haven't tried) and doesn't have any released source (although it is 
freeware). However, FWIW, I do intend to make and release an open-source 
cross-platform equivalent to GOLD (fully-compatible with GOLD, of course).

[Pro ANTLR] - ANTLR's grammar definition syntax includes certain bells and 
whistles that GOLD doesn't have, like extensive rewrite rules (with GOLD, 
you have to do rewrites yourself in your app).

[Pro GOLD] - I personally find ANTLR very difficult to learn as it's 
documentation seems to be quite poor. GOLD has very good documentation 
(although that's probably to be expected since GOLD seems to be much 
simpler).

[Pro ANTLR] - ANTLR seems to be much more popular and more heavily used. 
Sometimes a large user base can be good.

[Pro GOLD] - GOLD has much better support for various host languages (by 
that I mean languages that can be used to write the programs that will 
parse/manipulate the generated grammars). GOLD already supports far more 
host languages than ANTLR, and I'm certain this is because adding support 
for a host language is far easier in GOLD. Also, there's no ANTLR for D (I 
tried a while ago, but gave up since it was such a huge painful undertaking, 
I basically would have had to port an entire production-level Java app to 
D).

[Neutral] - With GOLD, host language is completely separated from grammar. 
This allows for far more flexibility (see some of the items below) and it 
makes the grammars much more reusable, but the cost is that you lose the 
convenience of being able to embed code directly into your grammar.

[Pro GOLD] - Since ANTLR wants to convert all it's grammars directly to 
lexer/parser source code, it's not a good choice for programs that need to 
be able to work with grammars that the *users* of your program generate. For 
example, I used GOLD to write a program that outputs the parse tree of any 
source file written in any GOLD grammar. An equivalent ANTLR program would 
have been far more difficult to create and to use.

[Pro GOLD] - Both GOLD and ANTLR come with GUI tools to help build grammars, 
but ANTLR's official GUI tool only works with grammars that have embedded 
Java (ie, grammars that are designed to be generated into a Java app, and 
not any other host language.) Because of GOLD's language-neutrality, it's 
GUI tool is helpful regardless of your desired host app.

[Pro ANTLR?] - GOLD's GUI tool *is* GOLD, and so (unless I'm mistaken) you 
can't use it as a command-line app (but I've found compiling grammars with 
it to be very painless, anyway). I *think* ANTLR can be used command-line. 
(But again, FWIW, I do intend to create an GOLD-compatible program that will 
work on the command line)

[Neutral] - ANTLR's GUI tool is probably a little more fully-featured 
(although maybe doesn't provide quite as detailed information, but then, 
maybe it doesn't need to), but in my experience, it's also very sluggish and 
resource-intensive.




More information about the Digitalmars-d-announce mailing list