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
Head
is the first part ofcrate::instruction::Instruction
and is used as a container for theState
and theSymbol
.- Instruction
Instruction
is a component ofcrate::program::Program
. This struct contains aHead
struct and aTail
struct and is used as a unit for instructions in the program.- State
- Wrapper around the
usize
type. 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::Instruction
and is used as a container for theState
, theSymbol
, and theMove
.
Enums§
- Move
- Move is a part of the
crate::instruction::Tail
and it’s used for tape shift direction determining bycrate::state::Configuration
. For any others structs direction value have no matter.