Expand description
Provides Instruction and it’s components: Head, Move,
State, Tail.
This module provides a unit struct named Instruction for implementing
this type for any type that implements Symbol trait.
§Examples
Creating a new Instruction through the Instruction::new method:
use turing_machine_rs::instruction::{Head, Instruction, Move, State, Tail};
let head = Head::new(State(1), '0');
let tail = Tail::new(State(0), '0', Move::Right);
// Moves head and tail from the scope
let inst = Instruction::new(head, tail);Creating a new Instruction through the Instruction::build method:
use turing_machine_rs::instruction::{Instruction, Move, State};
let inst = Instruction::build(State(1), '0', State(0), '0', Move::Right);Structs§
- Head
Headis the first part ofcrate::instruction::Instructionand is used as a container for theStateand theSymbol.- Instruction
Instructionis a component ofcrate::program::Program. This struct contains aHeadstruct and aTailstruct and is used as a unit for instructions in the program.- State
- Wrapper around the
usizetype. It is necessary for the decrease in value mismatching (when several values have the same type but two different meanings) but without the type limit. - Tail
- Tail is the second part of
crate::instruction::Instructionand is used as a container for theState, theSymbol, and theMove.
Enums§
- Move
- Move is a part of the
crate::instruction::Tailand it’s used for tape shift direction determining bycrate::state::Configuration. For any others structs direction value have no matter.