Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 1.32 KB

README.md

File metadata and controls

56 lines (38 loc) · 1.32 KB

Dylan Brainfuck

build

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".

Installation

TODO

Execution

brainfuck-app

where:

  • program is a brainfuck program
  • optimization-level is a number between 0 and 4 (default 4):
    • 0: No optimization
    • 1: Remove comments
    • 2: Group similar instructions (e.g. ++ becomes +2)
    • 3: Replace pattern [-] with a reset to zero
    • 4: Precalculate jumps (e.g. [+>] becomes [3+>]0

Examples

In the directory examples there are several brainfuck programs.

TODO

General

  • Load a program from a <string>
  • Load a program from a file (<locator>)

Instructions

  • increment-data
  • decrement-data
  • increment-pointer
  • decrement-pointer
  • input
  • output
  • jump-forward
  • jump-backward

Optimizations

  • Remove comments
  • Group instructions
  • Replace [-] pattern for a reset to zero instruction.
  • Precomputed jumps