A Brainfuck interpreter written in Swift.
You can install Brainfuck.swift via Swift Package Manager by adding the following line to your Package.swift
:
import PackageDescription
let package = Package(
[...]
dependencies: [
.package(url: "https://github.com/nerdsupremacist/Brainfuck.swift.git", from: "0.1.0"),
]
)
Brainfuck.swift comes with a parse
and a set of eval
functions.
You can use the directly with the program as a string:
let program = """
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
"""
let output: String = eval(program: program) // Hello World!\n
print(output)
Contributions are welcome and encouraged!
Brainfuck.swift is available under the MIT license. See the LICENSE file for more info.