pibfi
).
This application implements an interpreter for the language Brainf*ck. It does not by default impose any limit on the maximum length of the tape, nor the maximum value that can entered into any of the cells in the tape (beyond those limits inescapably imposed upon it by the underlying operating system and hardware.) It can, however, be configured to simulate the limits imposed upon the language by many other implementations which sacrifice scaleability in order to achieve other goals (usually, to build an astonishingly small compiler or interpreter.)
As such, pibfi
may be in a position to one day
develop into a universal (or at least reference) interpreter for
the Brainf*ck language.
For a synopsis of the command-line options that can be used
with pibfi
, see the
pibfi_options
documentation.
This module contains the interface to start pibfi
both from the command line, and programmatically. It also contains
common functions used by other pibfi_*
modules.
Parts of this program were derived from the Erlang example
program bf.erl
.
Exported Functions | |
---|---|
assert/2 | Asserts that the condition is true. |
assert_in_bounds/4 | |
os_eol/0 | Returns the native end-of-line convention, if it can be determined. |
run/1 | Starts pibfi for the purposes of running a Brainf*ck
program. |
run/6 | Runs a Brainf*ck program. |
startup/2 | |
whisper/1 | See whisper/2 . |
whisper/2 | Displays extra information. |
wrap/3 | Implements a generic modulus function. |
assert(Condition::boolean(), ErrorReason::term()) -> true
Asserts that the condition is true. If it is not, the process crashes with the given reason.
assert_in_bounds(Arg1, Arg2, Arg3, Arg4) -> term()
os_eol() -> string()
Returns the native end-of-line convention, if it can be determined. If it cannot be determined, linefeed (ASCII character 10) is assumed.
run(Args::[string()]) -> halt()
Starts pibfi
for the purposes of running a Brainf*ck
program. This function is intended to be invoked
from the command line. When using pibfi
from another Erlang
program, or from the Erlang shell, it is suggested you call
run/6
instead.
run(Supervisor::pid(), ProgramSource::binary(), ParserOptions::[{atom(), term()}], TapeOptions::[{atom(), term()}], IOOptions::[{atom(), term()}], DebugOptions::[{atom(), term()}]) -> tape()
Runs a Brainf*ck program.
startup(Arg1, Arg2) -> term()
whisper(string()) -> ok
Equivalent to whisper(string(), [])
.
whisper(string(), [term()]) -> ok
Displays extra information. The user can shut this off with
-quiet
.
wrap(Value::integer(), Max::integer(), Min::integer()) -> integer()
Implements a generic modulus function. Both the top and bottom modulus limits may be specified.