an overly-underengineered brainf**k interpreter written in Swift
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-19 03:32:52 +02: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 C translator: initialize the array to 0 2026-05-19 03:32:52 +02:00
Tests reindent 2026-02-06 19:43:41 -05:00
.gitattributes fix .gitattributes, take 3 2026-05-19 02:59:34 +02: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 screw sentence capitalization 2026-05-19 03:19:04 +02: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 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