#dfa #nfa #regex #finite

bin+lib automata

An implementation of standard finite state automata such as DFA, NFA, Regex

4 releases

Uses old Rust 2015

0.0.4 Mar 17, 2019
0.0.3 Nov 8, 2018
0.0.2 Mar 14, 2015
0.0.1 Mar 14, 2015

#165 in Parser tooling

Download history 8/week @ 2022-03-11 16/week @ 2022-03-18 1/week @ 2022-03-25 1/week @ 2022-04-01 1/week @ 2022-04-15 5/week @ 2022-04-22 13/week @ 2022-04-29 25/week @ 2022-05-06 70/week @ 2022-05-13 14/week @ 2022-05-20 27/week @ 2022-05-27 38/week @ 2022-06-03 4/week @ 2022-06-10 1/week @ 2022-06-17 6/week @ 2022-06-24

53 downloads per month

MIT license

64KB
1.5K SLoC

Automata

A rust library to model several different automata and algorithms. In its current form includes the following automata:

  • Deterministic Finite Automata (DFA)
  • Non-deterministic Finite Automata (NFA) with epsilon transitions

Visualization & Debugging

cargo run --bin test

Contained is an exporter to the popular dot format. A separate test binary also showcases construction and use of the exporter for example automata of each family and try to immediately show the images. This is handled by invoking dot–for conversion to png– and feh–for rendering the images–so make sure those are installed for the best effect.

NOTICE: Ownership transfer

This crate has recently changed ownership from gsingh93 and are now maintained following a university course. Supplementary material on theoretical questions might appear as part of the documentation.

Tests

cargo test

All units are tested, a bit stricter than their interface requirements, by automated unit tests. This includes automata construction, language recognition, word rejection, and the exporter.

Features

  • Dfa
    • word membership test
    • automaton pairing
  • Nfa
    • word membership (dynamic powerset)
    • conversion to regex
    • conversion to dfa
  • Regex
    • construction & printing over general alphabet
    • nothing particularly interesting yet

TODO

There are more features planned and/or in development

  • Converters–all of (dfa, nfa, regex) are equivalent
    • Dfa -> Nfa
    • Regex -> Nfa
    • Regx -> Dfa (directly, no det step)
  • Joins, Compositions, Intersects, Differences, Equivalence checks
  • Minimization
    • Quotienting (Hopcroft)
    • Dualization, Brzozowski’s algorithm, maybe.
  • Finite-state Transducers–and compositions
    • Join, Pre, Post
    • Membership, Projections
    • Presburger arithmetic, Modeling solutions to linear integer (in-)equalities with finite automata
  • Finite length languages
    • Minimization
    • Construction from NFA
    • Projection, Join, Pre, Post
  • Decision Diagrams
    • Intersect, complement
    • Minimization
  • Infinite-word automata
    • Büchi, Co-Büchi
    • NBA, Regex
    • DBA
    • Muller
    • Rabin
    • Streett
    • Parity
  • Algorithms on infinite automata
    • Union, Intersection
    • Complement
    • Emptiness
    • Emerson-Lei (liveliness)
  • Second-order logic
    • Finite word
    • Infinite universes

No runtime deps