Goldie: Grammar Definition Language

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

- Requirements
- Download / Install
- Never Used a Parsing Tool?
- Goldie Overview
- Beginner's Tutorial
- Grammar Definition Language
- Contact / Support
  - Message Board
  - Issue Tracking

Goldie's Tools

- AlterCGT
- 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 Static
- Calculator Dynamic
- Sample Generic Parse

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

- Scripts for Developers
- Library Source and StaticLang

Goldie Home (v0.9) -> 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 v5.0 features
- All of Goldie: Virtual terminals
- Goldie's grmc: User-defined terminals named EOF or Error

### See Also:

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