an overly-underengineered brainf**k interpreter written in Swift
- Swift 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .swiftpm | ||
| .vscode | ||
| Benchmarks | ||
| Programs | ||
| Sources | ||
| Tests | ||
| .gitattributes | ||
| .gitignore | ||
| .spi.yml | ||
| .swift-version | ||
| .swiftlint.yml | ||
| License.md | ||
| Package.resolved | ||
| Package.swift | ||
| Readme.md | ||
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