This is a tool to support the development of parol.
It creates Graphviz representations of parol
's lookahead DFAs. Parsers generated by parol
use
them during parsing to decide which production to choose next when facing a certain sequence of
input tokens.
The syntax is derived from the generated parser source (Rust). The tool transforms a generated parser file into DOT files which are put into the given output folder.
It also inserts the correct terminal name in lieu of the rather cryptic terminal index into the generated DOT files to increase readability.
This way changes in the resulting DFA could be evaluated much easier.
Try
cargo run -- --help
to get help.
To visualize the lookahead DFAs of the LL(5) grammar used by this crate call this
cargo run -- -f .\src\la_dfa_2_dot_parser.rs -o ..\la_dfa_2_dot_dot
Please note, that the invocation above will create a folder in parallel to the current crate's folder. This folder will contain the dot files derived resp. re-engineered form the parser used in this crate.
Inspect for instance the file ConstDeclaration.dot
which is a good example of a LL(5) lookahead
DFA.
la_dfa_2_dot
is free, open source and permissively licensed! Except where noted (below and/or in
individual files), all code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option. This means you can select the license you prefer!