Did you know ... | Search Documentation: |
Pack dot_dcg -- README.md |
This PROLOG library provides a definite clause grammar (DCG) for generating and parsing expressions in the DOT graph language. The DCG allows you to generate DOT expressions from a PROLOG DSL, and it allows you to parse DOT expressions into a the DSL.
doc_dcg is developed for SWI Prolog and available as a pack for installation:
?- pack_install(dot_dcg).
?- use_module(library(dot_dcg).
?- dot(Dot, `digraph mygraph { node1;node2 [label=\"My node\"];node1->node2; }`, []). Dot = digraph("mygraph", [node_stmt("node1"), node_stmt("node2", [attr("label", ""My node"")]), edge_stmt(["node1", "node2"])])
?- dot(digraph("mygraph", [edge_stmt(["node1", "node3"]), node_stmt("node2", [attr("label", "\"My node\"")]), edge_stmt(["node1", "node2"])]), X, []), format(X). digraph mygraph {node1->node3;node2 [label="My node"];node1->node2}