Files
turing_machine/src/lib.rs
T
2026-11-17 17:49:17 +01:00

25 lines
593 B
Rust

mod machine;
mod tape;
use std::fmt::Display;
pub use machine::NextState;
pub use machine::StateId;
pub use machine::TuringMachine;
#[derive(Debug)]
pub enum TuringMachineError {
DuplicateStateEntryKey(String),
StateEntryParsing(String),
}
impl Display for TuringMachineError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use TuringMachineError::*;
match self {
DuplicateStateEntryKey(key) => write!(f, "duplicate key in state table: {}", key),
StateEntryParsing(entry) => write!(f, "could not parse state entry: {}", entry),
}
}
}