automata_core
Deterministic and nondeterministic automaton algorithms in Rust.
The crate is built around a generic automaton trait layer (general). Some
algorithms live in the finite module and require enumerating states and
input symbols (so they work with finite-state/finite-alphabet automata).
The public trait layer does not include ε-transitions.
This crate is not affiliated with the unrelated crate on crates.io named
automata (https://crates.io/crates/automata).
What it does
The library provides:
- Base trait layers for generic automata concepts (
general) - A finiteness layer for algorithms that require finite state sets and finite alphabets (
finite) - Concrete reference implementations (
simple), plus a set of integration tests
The main emphasis is to keep the public trait layer free of ε-transitions.
Implemented
High-level operations (typically provided as trait methods):
- Determinization (
to_dfa) for NFAs - Boolean/structural operations:
union,intersection,difference,concatenate,star - N-ary operations:
union_all,intersect_all,concatenate_all - Closure operations:
reverse,trimmed,accessible,co_accessible - DFA completion and complement:
complete,complement(requires a total DFA pipeline) - Brzozowski minimization (
minimize)
Debug/interop helpers:
FiniteAutomaton::to_dot(Graphviz DOT) for visual inspectionDeterministicFiniteAutomaton::to_matrix(DFA transition matrix)
Quick example
use SimpleDFA;
use DeterministicFiniteAutomaton;
use DeterministicAutomaton;
let alphabet = ;
// 0 = even length, 1 = odd length
let edges = ;
let dfa = try_new.unwrap;
assert!;
assert!;
assert!;
Module organization
general: the baseAutomatontrait + determinism/nondeterminism helpersfinite: finiteness-bound traits and algorithmic operationssimple:SimpleDFA/SimpleNFAconcrete implementations
WIP / status
This library is work-in-progress. While the core constructions and trait APIs are in place, test coverage is still incomplete and some debug helpers are not finished yet.
Known TODOs:
FiniteAutomaton::to_dot(Graphviz DOT export) is not implemented yet.
License
MIT OR Apache-2.0