[$name|Parse$]
[$title|Parse$]
[$frame|HTMLPage.tmpl$]
<p>
Parses any source according to any
[$pageLink|CGT| CGT file $],
and saves the resulting
tokens and parse tree to [$pageLink|ParseTreeMode| JSON files $].
These JSON files can be inspected with
the enhanced version of [$pageName|JsonViewer$] bundled with Goldie.
</p>

<h3>Example:</h3>
<p>
If the file extension of your source is the same as the name of a CGT file in
Goldie's [$code|inline|lang/$] directory:
</p>
<div class="api-def">
<div class="code-plain">&gt;[$code|user| goldie-parse lang/valid_sample2.calc $]</div>
</div>

<p>
To use a specific CGT file:
</p>
<div class="api-def">
<div class="code-plain">&gt;[$code|user| goldie-parse -lang:/home/me/myLanguages/calc.cgt lang/valid_sample2.calc $]</div>
</div>

<p>
The above examples will create the following files in the same directory
as [$code|inline|valid_sample2.calc$]:
</p>
<div class="api-def">
[$code|plain|
[:valid_sample2.calc.tk.json
valid_sample2.calc.pt.json:]
$]
</div>
<p>
The [$code|inline|.tk.json$] file contains the tokenization (ie, the result
of the [$pageLink|LearnParsing#Frontend|Lexing$] phase) of [$code|inline|valid_sample2.calc$].
</p>
<p>
The [$code|inline|.pt.json$] file contains the parse tree (ie, the result
of the [$pageLink|LearnParsing#Frontend|Parsing$] phase) of [$code|inline|valid_sample2.calc$].
</p>
<p>
Either of the [$code|inline|.json$] files can be opened in [$pageTitle|JsonViewer$]
and will be browsable using JsonViewer's [$pageLink|ParseTreeMode|Parse Tree Mode$].
</p>

<p>
<span style="font-weight: bold">Note:</span>
Keep in mind, especially when using [$ident|Parse$] with
[$pageTitle|JsonViewer$], that parse trees tend to get very large, very fast.
</p>

<h3>Command-line parameters:</h3>
[$code|plain|
[: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
  &lt;text&gt;        (Required) Input filename
  -lang:&lt;text&gt;  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:&lt;text&gt;   Parse tree file type ("json" or "xml") (default: "json")
  -tkt:&lt;text&gt;   Token file type ("json" or "xml") (default: "json")
  -pto:&lt;text&gt;   Parse tree output filename
  -tko:&lt;text&gt;   Token output filename
  -debug        Display debug information:]
$]
