Goldie: Grammar Definition Language

Goldie
Parsing System (v0.4)
Goldie Home (v0.4)
Getting Started

- Requirements
- Download / Install
- Never Used a Parsing Tool?
- How To Use Goldie
- Grammar Definition Language
- Message Board
- Ticket System

Goldie's Tools

- DumpCGT
- GenDocs
  - Template Format
- GRMC: Grammar Compiler
- JsonViewer
  - Parse Tree Mode
- Parse
- StaticLang
- Other Tools

GoldieLib Overview

- Static And Dynamic Styles
- Ambiguous Symbols

GoldieLib Reference

- Base
- Exception
- class Language
- class Lexer
- class Parser
- struct Symbol
- class Token
- Ver

GoldieLib Sample Apps

- Calculator Dynamic
- Calculator Static
- Parse Anything

CGT File Format
FAQ
Change Log
If You Use Trunk
Future Work
Developers

- Library Source and StaticLang

Goldie Home (v0.4) -> Getting Started -> Grammar Definition Language

# Grammar Definition Language

Goldie uses the same GOLD Meta-Language grammar definition language as GOLD Parser Builder.

GOLD Parser Builder includes a grammar editor that features syntax highlighting, a grammar-generating wizard, and importing/exporting with YACC/Bison format. Goldie's calc.grm grammar below was created by using GOLD's grammar wizard (and slightly modifying the result).

Other premade grammars can be found in GOLD's downloads section.

## Sample

As a simple example of what a grammar looks like, this is the calc.grm grammar included with Goldie and used by the Sample Apps:
! -- Parameters ---------------------------------------- ! Basic Calculator Grammar ! Supports integer literals, + - * / () and whitespace "Name" = 'Calc' "Author" = 'GOLD Parser Builder and Nick Sabalausky' "Version" = '0.01' "About" = 'Basic Calculator Grammar' "Case Sensitive" = false "Start Symbol" = <Add Exp> ! -- Terminals ----------------------------------------- Number = {Digit}+ Whitespace = {Whitespace}+ ! -- Rules --------------------------------------------- <Add Exp> ::= <Add Exp> '+' <Mult Exp> | <Add Exp> '-' <Mult Exp> | <Mult Exp> <Mult Exp> ::= <Mult Exp> '*' <Negate Exp> | <Mult Exp> '/' <Negate Exp> | <Negate Exp> <Negate Exp> ::= '-' <Value> | <Value> <Value> ::= 'Number' | '(' <Add Exp> ')'

## Current Limitations

There are a few GOLD features that Goldie doesn't yet support:

- All of Goldie: The new GOLD v4.2 features
- All of Goldie: Virtual terminals
- Goldie's grmc: User-defined terminals named EOF or Error
- Goldie's grmc: The {All Valid} character set

### See Also:

- Official GOLD Meta-Language documentation
- Tokens, Symbols, and Symbol Types: The Front-End's Building Blocks
- Sample calculator grammar
- Premade Grammars