Parsing System (v0.9)
Goldie Home (v0.9) -> Goldie's Tools -> 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.


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:

The .tk.json file contains the tokenization of valid_sample2.calc. Ie, the result of the Lexing phase.

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

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:

Usage: goldie-parse [options] source-file [options] Examples: goldie-parse lang/valid_sample2.calc goldie-parse lang/valid_sample2.calc --lang=lang/calc.cgt If --lang is not specified, goldie-parse will look in Goldie's own 'lang' subdirectory for a CGT file with a name matching the source file's extension. --help, /? Displays this help screen -l, --lang <cgt> CGT file of language (default: "{goldie}/lang/{src ext}.cgt") --pto <filename> Parse tree output filename --tko <filename> Token output filename --no-pt Don't save parse tree --no-tk Don't save tokens -p, --pretty Pretty format output -t, --type <type> Output type: "json" or "xml" (default: "json") --debug Display debug information