Expand description

This crate is a parser for DOT/Graphviz files. The parser strictly sticks to the grammar specified here. The main structure is Graph, which can be built from a DOT file. The fields (and subfields) of the structure coincide with rules of the grammar.

The crate contains two modules: ast and canonical. Both contain a Graph structure that represent a DOT graph. In the ast module, the Graph structure is an abstract syntax tree of a given DOT graph. However, in practice, such graph is not easy to work with. Therefore, the Graph structure in the canonical module aims to provide a canonic representation of the graph, much easier to work with.

Modules

This module implements an Abstract Syntax Tree for Dot graphs. The main structure is Graph, which corresponds to the graph non-terminal in the grammar.

This modules implement “Canonical graphs”. This is motivated by the fact that graphs parsed naively may be difficult to work with, from a programming viewpoint: typically, attr_list in the grammar are defined as “[ID = ID, …][ID = ID, …]”. Therefore, we may want to flatten such structures. This is done in the canonical module.