[antlr-interest] Visually display the DFA ANTLR generates
Randall R Schulz
rschulz at sonic.net
Wed Jun 27 07:14:23 PDT 2007
On Wednesday 27 June 2007 06:55, Randall R Schulz wrote:
> On Wednesday 27 June 2007 06:46, Geoffrey Zhu wrote:
> > Does anyone know how to visually display the DFA ANTLR generates?
> >
> > For example, ANTLR generates the following DFA, but it is just too
> > difficult for me to figure out what it is doing.
>
> ANTLworks can show you a graphical representation of the lexer DFA
> and of the choice DFA for individual rules. You have to have the
> GraphViz package installed so ANLTRworks can invoke its "dot"
> command.
By the way, it's worth pointing out that once you've issued the "Show
Decision DFA" or "Show Tokens DFA" ocmmands and a new tab displaying
the resulting graph is opened, you can right-click in the tabs produced
and save the result as EPS (Encapsulated PostScript), a bit-map or DOT.
With DOT format, which is a textual description that the "dot" command
uses to produce a graph, you can then edit the file to alter its layout
options or use it to produce external documentation.
You can also get quite a surprise when seemingly simple rules produce
grotesque DFAs!
Randall Schulz
More information about the antlr-interest
mailing list