Struct boolfuck::Boolfuck [] [src]

pub struct Boolfuck { /* fields omitted */ }

A simple struct which contains boolfuck code and can run that code.

Examples

use boolfuck::Boolfuck;

let program = Boolfuck::new(",>,>,>,>,>,>,>,<<<<<<<;>;>;>;>;>;>;>;");

program.run(false);

Methods

impl Boolfuck
[src]

Creates a new instance of Boolfuck taking a &str as input, this string is used as the source code.

Panic

In case there are unclosed brackets the program panics!

Examples

use boolfuck::Boolfuck;

let program = Boolfuck::new(",>,>,>,>,>,>,>,<<<<<<<;>;>;>;>;>;>;>;");

program.run(false);

Creates a new instance of Boolfuck taking a string of Brainfuck code as input, this string gets converted to Boolfuck.

This is completely unoptimized!

Panic

In case there are unclosed brackets the program panics!

Examples

use boolfuck::Boolfuck;

let program = Boolfuck::from_brainfuck(",.");

program.run(false);

Runs the code saved inside of the struct, in case present is true the value of all cells is shown after the program has finished.

Examples

use boolfuck::Boolfuck;

let program = Boolfuck::new(",>,>,>,>,>,>,>,<<<<<<<;>;>;>;>;>;>;>;");

program.run(true);

Returns the representation of Boolfuck code used in this struct, this code can be converted to string using to_string()

and then get used a a input for another Boolfuck instance.

Examples

use boolfuck::Boolfuck;
use boolfuck::ToString;

let program = Boolfuck::new(",>,>,>,>,>,>,>,<<<<<<<;>;>;>;>;>;>;>;");

let program = Boolfuck::new(&program.get_tokens().to_string());

program.run(true);

Trait Implementations

impl Debug for Boolfuck
[src]

Displays the used source code.