Skip to content

nerdsupremacist/Brainfuck.swift

Repository files navigation

Brainfuck.swift

A Brainfuck interpreter written in Swift.

Installation

Swift Package Manager

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"),
    ]
)

Usage

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

Contributions are welcome and encouraged!

License

Brainfuck.swift is available under the MIT license. See the LICENSE file for more info.

About

A Brainfuck interpreter written in Swift. Just because!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages