Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "dot_dcg"

Title:A DCG for a subset of the DOT language
Rating:Not rated. Create the first rating!
Latest version:0.1.0
SHA1 sum:e6fd689f586d4d6d74874c4a041aa637b8fb0cd9
Author:Lee Coomber <github@coomber.org>
Packager:Eyal <edechter@mit.edu>

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.1.0e6df6e284040736be13ebe1f184ad4125a51dbee1http://github.com/edechter/dot_dcg.git
5f4d7d481d0cfb1272cdd9faf117e223a08047bc1https://github.com/edechter/dot_dcg.git
e6fd689f586d4d6d74874c4a041aa637b8fb0cd91https://github.com/edechter/dot_dcg.git
0cc63200260cfc765ff1ffd212eb157d959cb8221http://github.com/edechter/dot_dcg.git
a89589270905202b49a435e06642d0bf66377f4923http://github.com/edechter/dot_dcg.git
https://github.com/edechter/dot_dcg.git

Synposis

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.

Installation

doc_dcg is developed for SWI Prolog and available as a pack for installation:

?- pack_install(dot_dcg).

Examples

  • Load library into SWI Prolog session:
    ?- use_module(library(dot_dcg).
  • Parse DOT graph into DSL:
    
    ?- 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"])])
    
  • Generate DOT graph from DSL expression:
    
    ?- 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}
    

Contents of pack "dot_dcg"

Pack contains 6 files holding a total of 12.0K bytes.