Struct sbrain::SBrainVM [] [src]

pub struct SBrainVM { /* fields omitted */ }

A virtual machine modelling the SBrain Turing machine. This machine implements the specification relatively strictly, providing exactly 216 (65536) data and instruction cells. Thus, all pointers are 16 bits and all data is 32 bits. The main deviation from the minimum specification is the jump stack, which is indefinitely expandable.

Methods

impl SBrainVM
[src]

Return a new SBrainVM, with no data in any tapes.

Load a program tape: copy data from the given slice into the executable tape. On error, the Err(s) return will contain a message describing the error.

Load a data tape: copy data from the given slice into the VM's data tape. On error, the Err(s) return will contain a message describing the error.

Return a copy of the output data of the machine

Run the machine, until completion (cycles = None) or for n cycles (cycles = Some(n)). Return values are number of cycles run and why the machine stopped: false if due to a program halt (instr 31), false if due to running out of cycles.