# Polka A [dot](https://en.wikipedia.org/wiki/DOT_(graph_description_language)) language parser for Rust; based on [Parser Expression Grammar (PEG)](https://en.wikipedia.org/wiki/Parsing_expression_grammar) using the excellent [pest](http://pest.rs) crate as the underpinning. ![](logo.png) --- ### Usage (as a Rust Library) 0. Add this to your `Cargo.toml`: ```toml [dependencies] rand = "0.6" ``` 1. Call the `parser` function by passing an input `String` ```rust extern crate polka; use polka::parse; fn main() { let input = "digraph { a -> b -> c }".to_string(); println!("Polka AST\n: {:?}", parse(input).unwrap()); } // Polka AST: // Graph { // strict: false, // graph_type: Some( // Digraph, // ), // id: None, // statements: [ // EdgeStatement( // EdgeStatement { // edge: NodeId( // NodeId { // node_id: "a", // port: None, // }, // ), // edge_rhs_list: [ // EdgeRhs { // edge_op: Arrow, // edge: NodeId( // NodeId { // node_id: "b", // port: None, // }, // ), // }, // EdgeRhs { // edge_op: Arrow, // edge: NodeId( // NodeId { // node_id: "c", // port: None, // }, // ), // }, // ], // attributes: None, // }, // ), // ], // } ``` --- ### Known Limitations: 1. HTML ids are currently not supported. ### License [MIT](./LICENSE)