Module instruction

Module instruction 

Source
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 of crate::instruction::Instruction and is used as a container for the State and the Symbol.
Instruction
Instruction is a component of crate::program::Program. This struct contains a Head struct and a Tail 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 the State, the Symbol, and the Move.

Enums§

Move
Move is a part of the crate::instruction::Tail and it’s used for tape shift direction determining by crate::state::Configuration. For any others structs direction value have no matter.