Brainfuck interpreter written in Opendylan programming language.
This is an exploration of Opendylan features (mainly multimethods) and is not trying to be "as fast as possible".
TODO
brainfuck-app
where:
- program is a brainfuck program
- optimization-level is a number between 0 and 4 (default
4
):0
: No optimization1
: Remove comments2
: Group similar instructions (e.g.++
becomes+2
)3
: Replace pattern[-]
with a reset to zero4
: Precalculate jumps (e.g.[+>]
becomes[3+>]0
In the directory examples
there are several brainfuck programs.
- Load a program from a
<string>
- Load a program from a file (
<locator>
)
- increment-data
- decrement-data
- increment-pointer
- decrement-pointer
- input
- output
- jump-forward
- jump-backward
- Remove comments
- Group instructions
- Replace
[-]
pattern for a reset to zero instruction. - Precomputed jumps