[$name|GRMC$]
[$title|GRMC: Grammar Compiler$]
[$frame|HTMLPage.tmpl$]
<p>
Compiles a 
[$pageLink|Grammar| grammar definition file $]
to a
[$pageLink|CGT| 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
[$link| http://www.devincook.com/goldparser/about/how-it-works.htm |GOLD Engine$].
</p>

<p>
Note that there are a few
[$pageLink|OtherTools#GOLD| GOLD Parser Builder $]
features that Goldie Grammar Compiler does not yet support:
</p>
<ul>
<li>The [$link| http://www.devincook.com/goldparser/v4.2.htm | new GOLD v4.2 features $]</li>
<li>[$link| http://www.devincook.com/goldparser/doc/grammars/virtual-terminals.htm | Virtual terminals $]</li>
<li>User-defined terminals named [$ident|EOF$] or [$ident|Error$]</li>
<li>The [$ident|{All Valid}$] character set</li>
</ul>

<h3>Command-line parameters:</h3>
[$code|plain|
[: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
  &lt;text&gt;       (Required) Grammar definition in .grm format
  -o:&lt;text&gt;    Output filename
  -v           Verbose
  -gold        Imitate GOLD's output as closely as possible
  -dot         Output lexer's NFA and DFA to Graphviz DOT format:]
$]

<p>
The [$code|inline|-dot$] parameter is interesting because it allows you to
use [$link|http://www.graphviz.org/|Graphviz$] (or any other
[$link|http://en.wikipedia.org/wiki/DOT_language|DOT$]-compatible
visualization software) to create visual graphs
of the lexer's original NFA and its resulting
[$link|http://www.devincook.com/goldparser/articles/dfa.htm|DFA$].
</p>

<p>
The [$code|inline|-gold$] parameter needs a little clarification:
</p>

<p>
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.
</p>

<p>
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.
</p>

<p>
If this happens, you can use the [$code|inline|-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.
</p>

<h3 class="list-heading">See Also:</h3>
<ul>
<li>[$pageTitle| Grammar $]</li>
<li>[$pageTitle| CGT $]</li>
<li>[$link| http://www.devincook.com/goldparser/doc/grammars/index.htm | GOLD's documentation for the GRM grammar definition language $]</li>
<li>[$link| http://www.devincook.com/goldparser/doc/cgt/index.htm | GOLD's documentation for the CGT file format $]</li>
</ul>
