Goldie: Parse

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 -> Parse

# Parse

Parses any source according to any CGT file, and saves the resulting tokens and parse tree to JSON files. These JSON files can be inspected with the enhanced version of JsonViewer bundled with Goldie.

### Example:

If the file extension of your source is the same as the name of a CGT file in Goldie's lang/ directory:

>goldie-parse lang/valid_sample2.calc

To use a specific CGT file:

>goldie-parse -lang:/home/me/myLanguages/calc.cgt lang/valid_sample2.calc

The above examples will create the following files in the same directory as valid_sample2.calc:

valid_sample2.calc.tk.json valid_sample2.calc.pt.json

The .tk.json file contains the tokenization (ie, the result of the Lexing phase) of valid_sample2.calc.

The .pt.json file contains the parse tree (ie, the result of the Parsing phase) of valid_sample2.calc.

Either of the .json files can be opened in JsonViewer and will be browsable using JsonViewer's Parse Tree Mode.

Note: Keep in mind, especially when using Parse with JsonViewer, that parse trees tend to get very large, very fast.

### Command-line parameters:

Sample Usage: goldie-parse lang/valid_sample2.calc Switches: (Prefixes can be '/', '-' or '--') ('[]' means multiple switches are accepted) Basic: -help Displays a help summary and exits -detail Displays a detailed help message and exits <text> (Required) Input filename -lang:<text> CGT file of language (default: "{goldie}/lang/{src ext}.cgt") Advanced: -ptn Don't save parse tree -tkn Don't save tokens -ptp Pretty format parse tree file -tkp Pretty format token file -ptt:<text> Parse tree file type ("json" or "xml") (default: "json") -tkt:<text> Token file type ("json" or "xml") (default: "json") -pto:<text> Parse tree output filename -tko:<text> Token output filename -debug Display debug information