Enum bf::common::Instruction [−][src]
pub enum Instruction {
Left(Count),
Right(Count),
Add(u8),
In,
Out,
JumpZero(Count),
JumpNotZero(Count),
SetZero,
OffsetAddRight(Count),
OffsetAddLeft(Count),
FindZeroRight(Count),
FindZeroLeft(Count),
}Instructions as output by the bytecode flattener.
These include the result of peephole optimizations that turn sequences of Brainfuck commands into non-Brainfuck instructions that are understood by the appropriate interpreters and the JIT compiler.
Unlike in the earlier passes, the loop instructions
do not include a boxed slice of instructions as a
subtree. Note that this type is Copy.
Variants
Left(Count)Decrease the pointer by the specified offset.
Right(Count)Increase the pointer by the specified offset.
Add(u8)Increase the current byte value by the specified offset.
InRead a byte of input.
OutWrite a byte of output.
JumpZero(Count)Begin a loop, jumping to the end if the current byte value is 0.
The Count is the address of the matching JumpNotZero instruction.
JumpNotZero(Count)End a loop if the current byte value is 0; otherwise repeat the loop.
The Count is the address of the matching JumpZero instruction.
SetZeroSet the current byte value to 0.
Equivalent to the concrete Braincode loop [-].
OffsetAddRight(Count)Add the byte at the pointer to the byte at the specified offset and zero the byte at the pointer.
OffsetAddRight(5) is equivalent to the concrete Brainfuck loop [->>>>>+<<<<<].
OffsetAddLeft(Count)Add the byte at the pointer to the byte at the specified offset and zero the byte at the pointer.
OffsetAddRight(5) is equivalent to the concrete Brainfuck loop [-<<<<<+>>>>>].
FindZeroRight(Count)Finds the nearest zero to the left that appears offset by a multiple of the given Count.
FindZeroRight(3) is equivalent to the concrete Brainfuck loop [>>>].
FindZeroLeft(Count)Finds the nearest zero to the right that appears offset by a multiple of the given Count.
FindZeroLeft(3) is equivalent to the concrete Brainfuck loop [<<<].
Trait Implementations
impl Copy for Instruction[src]
impl Copy for Instructionimpl Clone for Instruction[src]
impl Clone for Instructionfn clone(&self) -> Instruction[src]
fn clone(&self) -> InstructionReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for Instruction[src]
impl Debug for Instructionfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Eq for Instruction[src]
impl Eq for Instructionimpl PartialEq for Instruction[src]
impl PartialEq for Instructionfn eq(&self, other: &Instruction) -> bool[src]
fn eq(&self, other: &Instruction) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Instruction) -> bool[src]
fn ne(&self, other: &Instruction) -> boolThis method tests for !=.
Auto Trait Implementations
impl Send for Instruction
impl Send for Instructionimpl Sync for Instruction
impl Sync for Instruction