| Crates.io | oak-dot |
| lib.rs | oak-dot |
| version | 0.0.1 |
| created_at | 2025-10-20 16:35:10.623552+00 |
| updated_at | 2026-01-23 04:27:39.340502+00 |
| description | High-performance incremental DOT language parser for the oak ecosystem with flexible configuration, optimized for graph description and visualization. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 1892303 |
| size | 70,342 |
Oak of dot is a powerful and efficient parser for the DOT graph description language, built using the oak parser combinator library. It provides a robust solution for parsing DOT syntax, enabling various applications such as static analysis of graph definitions, visualization tools, and automated graph generation.
oak's optimized parsing techniques for speed.To use Oak of dot in your Rust project, add it as a dependency in your Cargo.toml:
[dependencies]
Oak of dot = "0.1.0" # Replace with the latest version
oak = "0.1.0" # Replace with the latest version
Here's a simple example demonstrating how to parse DOT language content:
use pex_dot::dot_parser;
fn main() {
let input = r#"
digraph G {
A -> B;
B -> C;
C -> A;
}
"#;
match dot_parser::parse(input) {
Ok(ast) => {
println!("Successfully parsed DOT:\n{:#?}", ast);
}
Err(err) => {
eprintln!("Failed to parse DOT: {}", err);
}
}
}
The oak library allows for flexible customization of the parser. You can modify the grammar rules or add new ones to suit your specific needs, such as supporting experimental DOT features. Refer to the oak documentation for more details on parser customization.
Oak of dot can be extended with error recovery mechanisms to handle malformed DOT files gracefully, allowing for partial parsing and better resilience in real-world scenarios.
The generated AST for DOT provides a hierarchical representation of the graph elements. For instance, a node definition might result in an AST structure similar to this:
// Simplified AST representation for:
// A -> B;
pex_dot::ast::Node::Edge {
source: "A".to_string(),
target: "B".to_string(),
attributes: vec![],
}
Oak of dot is designed for performance. Benchmarks show efficient parsing of large DOT files. Optimizations include memoization, efficient backtracking, and direct AST construction.
Oak of dot can be integrated into various tools and applications:
Explore the examples directory within the oak-dot project for more usage examples and demonstrations of specific DOT parsing features.
Contributions to Oak of dot are welcome! If you find a bug or have a feature request, please open an issue on the GitHub repository. For major changes, please open a discussion first.