Crate tur

Source
Expand description

This crate provides the core logic for a Turing Machine simulator. It includes modules for parsing Turing Machine programs, simulating their execution, analyzing program correctness, and managing a collection of predefined programs.

Re-exports§

pub use crate::parser::Rule;
pub use analyzer::analyze;
pub use analyzer::AnalysisError;
pub use loader::ProgramLoader;
pub use machine::TuringMachine;
pub use parser::parse;
pub use programs::ProgramInfo;
pub use programs::ProgramManager;
pub use programs::PROGRAMS;
pub use types::Direction;
pub use types::ExecutionResult;
pub use types::ExecutionStep;
pub use types::Program;
pub use types::Transition;
pub use types::TuringMachineError;
pub use types::MAX_PROGRAM_SIZE;

Modules§

analyzer
This module provides functions for analyzing Turing Machine programs to detect common errors and inconsistencies before execution. This includes checks for valid head positions, defined states, reachable states, and handled tape symbols.
loader
This module provides the ProgramLoader struct, responsible for loading Turing Machine programs from various sources, including files and strings.
machine
This module defines the TuringMachine struct, which simulates the behavior of a multi-tape Turing Machine. It handles the machine’s state, tape operations, head movements, and execution of transition rules.
parser
This module provides the parser for Turing Machine programs, utilizing the pest crate. It defines the grammar for .tur files and functions to parse the input into a Program struct.
programs
types
This module defines the core data structures and types used throughout the Turing Machine simulator, including program representation, transitions, execution results, and error types.