Turing Machine RS

A library for implementing any Turing machine with minimal limitations for the Rust programming language. It is:

Crates.io MIT licensed Rust 2021 Rust Stable Rust Nightly

Docs

Overview

Turing Machine RS includes a "Classic" realization for Turing Machine (a minimal version for simulation) and a "Debugger" Turing Machine that works with any type that implements the Turing Machine Trait.

Example

This is a simple example of a Turing Machine that replaces nice by test and test by nice words.

```rust extern crate turingmachiners;

use turingmachiners::instruction::{Move, State}; use turingmachiners::machines::Classic; use turingmachiners::program::{Extend, Program}; use turingmachiners::state::Tape; use turingmachiners::TuringMachine;

// For more comfortable coding, use Result<(), String>: // ? postfix symbol is better then .unwrap() postfix method call. fn main() -> Result<(), String> { let alphabet = vec!['t', 'e', 's', 'n', 'i', 'c', 'e', '']; let mut program = Program::new(alphabet, State(4)); program.extend([ (1, 't', 2, 'n', Move::Right), (2, 'e', 3, 'i', Move::Right), (3, 's', 4, 'c', Move::Right), (4, 't', 0, 'e', Move::None), // Revers (1, 'n', 2, 't', Move::Right), (2, 'i', 3, 'e', Move::Right), (3, 'c', 4, 's', Move::Right), (4, 'e', 0, 't', Move::None), ])?; let machine = Classic::new(program, '')?;

let test = Tape::from("test");
let nice = machine.translate_nrm(test.clone())?;
println!(
    "{} {}!",
    String::from_iter(nice.as_vec()),
    String::from_iter(test.as_vec())
);
Ok(())

} ```

But this library is not just for the simplest types: you can even use other Turing machines as symbols! More examples can be found here.

Getting Help

First, read examples or docs. If examples can't provide answers for you, then you can try to read docs, and after all of that, you can contact me: helltraitor@hotmail.com

Major links:

Contributing

If you want to improve this crate, just open an issue (you can use example as a template). The issue must contain these headings: Problem or Enhancement, Motivation (reasons to solve the problem or implement the enhancement). It would be very useful to add Useful sources for documentation and examples.

See example.

Supported Rust Versions

Turing Machine RS was created in the latest stable version (2021, 1.57) but this library also supports 1.56 (at least) and above.

License

This project is licensed under the [MIT license].

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Turing Machine RS by you, shall be licensed as MIT, without any additional terms or conditions.