Goldie: GRMC: Grammar Compiler

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) -> Goldie's Tools -> GRMC: Grammar Compiler

# GRMC: Grammar Compiler

Compiles a grammar definition file to a CGT file (Compiled Grammar Table). This tool can be used instead of GOLD Parser Builder. The resulting .cgt files can be used with either Goldie or any other GOLD Engine.

Note that there are a few GOLD Parser Builder features that Goldie Grammar Compiler does not yet support:

- The new GOLD v4.2 features
- Virtual terminals
- User-defined terminals named EOF or Error
- The {All Valid} character set

### Command-line parameters:

Usage: goldie-grmc grammar.grm goldie-grmc grammar.grm -o:output.cgt Switches: (Prefixes can be '/', '-' or '--') ('[]' means multiple switches are accepted) -help Displays a help summary and exits -detail Displays a detailed help message and exits <text> (Required) Grammar definition in .grm format -o:<text> Output filename -v Verbose -gold Imitate GOLD's output as closely as possible -dot Output lexer's NFA and DFA to Graphviz DOT format

The -dot parameter is interesting because it allows you to use Graphviz (or any other DOT-compatible visualization software) to create visual graphs of the lexer's original NFA and its resulting DFA.

The -gold parameter needs a little clarification:

The CGTs Goldie generates are always valid GOLD-compatible files that are functionally equivalent to the CGTs GOLD Parser Builder would generate. But there can still be some inconsequential differences, even though the CGTs behave exactly the same.

It's possible that another GOLD engine besides GoldieLib might mistakenly rely on some subtle detail of GOLD Parser Builder's output. Such an engine might accidentally handle Goldie's CGT slightly differently even though the CGTs normally would be functionally equivalent.

If this happens, you can use the -gold parameter: Goldie will jump through some extra hoops trying to emulate the normally-irrelevant details of GOLD Parser Builder as closely as possible. It still might not be exactly the same as GOLD Parser Builder's output, but it may at least be close enough.

### See Also:

- Grammar Definition Language
- CGT File Format
- GOLD's documentation for the GRM grammar definition language
- GOLD's documentation for the CGT file format