diff options
author | JSDurand <mmemmew@gmail.com> | 2022-12-23 00:36:31 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-12-23 00:36:31 +0800 |
commit | 8463dd24f815fe2b8f25fe9763e0a43023bfbb20 (patch) | |
tree | 343eea3c634efbbf72c64ed5dd778ecce60c3eea /viz/src | |
parent | 9f1c88b863e247da3cd60d2792a7a13b18e25e53 (diff) |
renaming core to chain and some other changes
Some changes:
- The core crate is renamed to "chain".
- The crate "viz" is added, which will provide layered graph drawing
algorithms.
- A function is added to convert from a grammar to the regular
language of its left-linear closures.
- A function is added to convert from a nondeterministic finite
automaton to its "null" closure. A null closure is the same
automaton with edges added, as if some edges are "null". Whether an
edge is null is determined by a function.
Combined with the previous change, we can convert a grammar to the
regular language of the null closure of its left-linear closures.
---
Now it remains to test more grammars and add an Atom trait, before
finishing the part about compilations.
Diffstat (limited to 'viz/src')
-rw-r--r-- | viz/src/lib.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/viz/src/lib.rs b/viz/src/lib.rs new file mode 100644 index 0000000..b40c78a --- /dev/null +++ b/viz/src/lib.rs @@ -0,0 +1,31 @@ +//! This library defines a binary format to store graph data such that +//! a client which understands the format can easily print the graph, +//! centered at any specific node, with any scope. The library also +//! provides functions to print graphs in this format. +//! +//! This way, one does not need a server to print and interact with +//! graphs. +//! +//! # Graph representation +//! +//! The library uses the [`Graph`][graph::Graph] trait from the crate +//! [graph]. Only the functions exposed from the trait are used by +//! this library. So the users can also implement the trait and then +//! print the graph data represented by other graph crates. + +extern crate graph; + +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} |