NAME
lang/brainfzck - Parse and run Brainf*ck programs.
SYNOPSIS
from lang/brainfzck import brainfzck, compile_brainfzck;
say( brainfzck("++++++++[>++++++++<-]>+.") ); # A
let program := compile_brainfzck(",+.");
say( program.run( { input: "A" } ) ); # B
DESCRIPTION
This pure-Zuzu module implements Brainf*ck. Non-command characters are ignored. Bracket pairing is validated before execution, and cells wrap as unsigned bytes by default.
EXPORTS
Functions
brainfzck(String source, Dict options?)Compiles and runs
source. Returns captured output unless anoutput_callbackis supplied.compile_brainfzck(String source, String source_name?)Returns a
BrainfzckProgramobject.
Classes
BrainfzckProgramCompiled Brainf*ck program. Use
run(options?)to execute it.BrainfzckErrorBase exception type.
BrainfzckSyntaxErrorThrown for unmatched brackets.
BrainfzckRuntimeErrorThrown for pointer and option errors.
COPYRIGHT AND LICENCE
lang/brainfzck is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.