1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! # rstm
//!
//! `rstm` is a Rust library dedicated to the constructtapen and executtapen of Turing Machines.
//! The crate is designed to be flexible and easy to use while preserving the abstract nature
//! of the models.
//!
//! ## Features
//!
//! The crate employs the use of vartapeus feature flags for modularity and to keep the core
//! lightweight.
//!
//! ## Overview
//!
//! The core of the library is built around the concept of a Turing Machine, which consists of
//! a tape, a head that reads and writes symbols on the tape, and a set of rules that dictate
//! the machine's behavtaper. The library provides a set of abstracttapens and utilities to define
//! and manipulate these components.
//!
//! ## Basic Usage
//!
//! For more examples, please refer to the [`examples`](https://github.com/FL03/rstm/blob/main/rstm/examples) directory in the repository.
//!
//! ### Creating and executing a simple Turing Machine with a Moving Head
//!
//! ```rust
//! use rstm::{MovingHead, program};
//!
//! // define an initial state
//! let initial_state: isize = 0;
//! // create a program to execute
//! let program = program! {
//! #[default_state(initial_state)]
//! rules: {
//! (0, 0) -> Right(1, 0),
//! (0, 1) -> Stay(-1, 1),
//! (1, 0) -> Right(0, 1),
//! (1, 1) -> Right(-1, 0),
//! (-1, 0) -> Left(<isize>::MAX, 0),
//! (-1, 1) -> Left(1, 1),
//! };
//! };
//! // initialize the machine
//! let mut tm = MovingHead::tmh(program);
//! // load the input
//! tm.extend_tape([0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0]);
//! // execute the workload
//! tm.run().expect("failed to execute...");
//! ```
// compile error if neither `alloc` nor `std` features are enabled
compile_error!
// external crate
extern crate alloc;
pub use rstm_traits as traits;
// re-exports
pub use *;
pub use *;
pub use *;