Parsing System (v0.7)
Goldie Home (v0.7) -> FAQ

FAQ

Q: How can I use Goldie to create a compiler?

A: This is not an easy task no matter what parsing tool you use. To get started, see the Never Used a Parsing Tool? page which contains an overview of everything involved in creating a full compiler.

In summary: Use Goldie to implement a lexer/parser (see Goldie Overview and the Beginner's Tutorial), and then, just as with any other parsing tool, you'll have to do your own semantic analysis on the resulting tree, and then implement a compiler backend.

Q: Why the name "Goldie"?

A: "GOLD for D" -> "GOLD D" -> "Goldie"

Q: How do I refer to a rule that has no subtokens?

A: Use null for the list of subtokens. For details and examples, see Referring to a rule that has no subtokens on the GoldieLib Overview page.

Q: I'm getting "Ambiguous symbol" errors!

A: See Ambiguous Symbols.

Q: This project sounds very similar to Gazelle. What's the difference, and which one is better?

A: GOLD/Goldie and Gazelle are both members of a new class of generic parsers that focus on fully-reusable grammars that aren't tied to any particular host language. They both accomplish this by completely separating the grammar from the parsing engine.

Both systems have their pros and cons, and which one's better is up to you. They're both evolving, so limitations on both sides are likely to change. Here is a comparison (disclaimer: based on my admittedly limited knowledge of Gazelle) so you can decide for yourself:

  Goldie Gazelle
Parser Type LALR(1) LL(*)
Grammars Compile To Tables Bytecode
Written In D C
Easily Used From Other Languages Yes Yes
Event-Based Parsing No Yes
Creates a Parse Tree Yes No
Speed Medium focus so far Strong focus so far
Usability (Tools, API, Docs, etc...) Strong focus so far Medium focus so far
Existing Ecosystem Fairly large, due to compatability with GOLD Currently limited to the main Gazelle project
Grammar Definition Expressiveness Powerful, but room for improvement Appears to be quite powerful
Regular Expressions for Defining Terminals GOLD's custom regex syntax, designed to be easy to read Standard PCRE regex
Various Tools Available Yes Yes
Integrated Lexing and Parsing Yes Yes
Library API for Compiling Grammars Yes Yes
Strives for Flexibility Yes Yes
Cross-Platform Yes Yes
Commandline Compatible Yes Yes
Open Source Yes, zlib/libpng Yes, 3-Clause BSD

(If anything in this comparison appears to be wrong or out-of-date, I invite you to file a bug report.)

Q: What about Goldie vs. ANTLR?

A: While Goldie and Gazelle are in roughly the same class, ANTLR is very different in that grammars are not independent from the host language.

  Goldie Gazelle ANTLR
Parser Type LALR(1) LL(*) LL(k)
Maturity Still young Still young Very mature, with a large following
Official Host Languages D C Java, C, C#, Python, ActionScript
Other Host Languages Available Yes No Yes
Easy to Support a New Host Language Yes Yes No. Typically, the entire ANTLR and StringTemplate projects must be ported.
Can Embed Source Code Into Grammar No No Yes
Reuse Grammars on Other Host Languages Yes Yes Typically, no. The embedded code must be ported.
Extensive Tools, Including GUIs Yes No Yes
Open Source Yes, zlib/libpng Yes, 3-Clause BSD Yes, 3-Clause BSD
Nutty Creator Yes Unknown Yes

(If anything in this comparison appears to be wrong or out-of-date, I invite you to file a bug report.)

Q: Are these questions really frequently-asked?

A: No, I'm just anticipating them. ;)