From 8463dd24f815fe2b8f25fe9763e0a43023bfbb20 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 23 Dec 2022 00:36:31 +0800 Subject: 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. --- chain/src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 chain/src/lib.rs (limited to 'chain/src/lib.rs') diff --git a/chain/src/lib.rs b/chain/src/lib.rs new file mode 100644 index 0000000..0ec4d4c --- /dev/null +++ b/chain/src/lib.rs @@ -0,0 +1,25 @@ +//! This package implements the core algorithm of the entire +//! workspace: parsing with derivatives by means of chain rule and +//! regular nulling languages. +//! +//! Since I shall not name my crate "core" to avoid collisions with +//! the Rust's own core, I decided to name this crate after what I +//! think is the essence of this algorithm, the chain-rule for +//! derivatives of languages. + +pub mod grammar; + +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); + } +} -- cgit v1.2.3-18-g5258