An overly-underengineered brainf**k interpreter written in Swift
  • Brainfuck 37.9%
  • Shell 35.8%
  • Swift 17.2%
  • Perl 9%
  • Roff 0.1%
2026-02-06 19:43:41 -05:00
.swiftpm simplify translation a bit 2026-02-06 19:26:51 -05:00
.vscode a bunch of changes that I don't really remember 2025-12-07 10:56:18 -05:00
Benchmarks reindent 2026-02-06 19:43:41 -05:00
Programs add back some optimizations 2025-09-05 10:40:19 -04:00
Sources reindent 2026-02-06 19:43:41 -05:00
Tests reindent 2026-02-06 19:43:41 -05:00
.gitignore update gitignore and hope it actually works this time 2025-09-07 11:10:58 -04:00
.spi.yml style: 🎨 minor formatting fixups 2025-04-21 08:29:00 -04:00
.swift-version mostly just formatting changes 2025-09-24 14:50:55 -04:00
.swiftlint.yml a bunch of changes that I don't really remember 2025-12-07 10:56:18 -05:00
License.md changes abound 2025-08-26 20:15:07 -04:00
Package.resolved simplify translation a bit 2026-02-06 19:26:51 -05:00
Package.swift reindent 2026-02-06 19:43:41 -05:00
Readme.md a bunch of changes that I don't really remember 2025-12-07 10:56:18 -05:00

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're using 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