Skip to content

Repository files navigation

BrainflipKit

an overly-underengineered brainfuck interpreter in Swift

Overview

BrainflipKit is a Swift command-line app that interprets brainfuck programs.

if you're here, then chances are you already know what brainfuck is (if not, here's a quick and dirty reference). so instead of dwelling on the basics, I'll go over what makes this interpreter marginally unique.

  • full Unicode support. that's just what happens when you use Swift
  • the cells are 64-bit instead of 8-bit, due to the aforementioned Unicode support. most well-written brainfuck programs shouldn't be heavily affected by this
  • the tape is infinite in both directions
  • the end-of-input behavior is customizable -- you can ignore EOI, set the cell to 0, or set the cell to its maximum
  • some relatively basic optimizations are performed, including:
    • condensing repeated instructions
    • merging +/- and </> instructions (and removing pairs that cancel each other out)
    • replacing multiplication loops with a dedicated instruction

About

An overly-underengineered brainf**k interpreter in Swift — moved to https://codeberg.org/kaascevich/brainflipkit

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages