5 releases

0.2.1 Sep 27, 2022
0.2.0 Aug 4, 2021
0.1.2 Jul 12, 2021
0.1.1 Jul 12, 2021
0.1.0 Jul 12, 2021

#562 in Programming languages

MIT license

22KB
525 lines

Brainfuck interpreter

Install

$ cargo install bfk

Usage

$ cat > hello.bf
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
$ bfk hello.bf
Hello World!

Create your own fuck

For example, Replace +-><,.[] with abcdefgh. This is replaced Hello World program in Brainfuck.

aaaaaaaagcaaaagcaacaaacaaacaddddbhcacacbccagdhdbhccfcbbbfaaaaaaaffaaafccfdbfdfaaafbbbbbbfbbbbbbbbfccafcaaf

By providing replacing character to language option, This interpreter runs it as a transformed Brainfuck program.

$ cat > hello.abc.bf
aaaaaaaagcaaaagcaacaaacaaacaddddbhcacacbccagdhdbhccfcbbbfaaaaaaaffaaafccfdbfdfaaafbbbbbbfbbbbbbbbfccafcaaf
$ bfk --language=abcdefgh hello.abc.bf
Hello World!

Even emojis.

$ cat > hello.emoji.bf
😀😀😀😀😀😀😀😀😂😄😀😀😀😀😂😄😀😀😄😀😀😀😄😀😀😀😄😀😁😁😁😁😃🤣😄😀😄😀😄😃😄😄😀😂😁🤣😁😃🤣😄😄😅😄😃😃😃😅😀😀😀😀😀😀😀😅😅😀😀😀😅😄😄😅😁😃😅😁😅😀😀😀😅😃😃😃😃😃😃😅😃😃😃😃😃😃😃😃😅😄😄😀😅😄😀😀😅
$ bfk --language=😀😃😄😁😆😅😂🤣 hello.emoji.bf
Hello World!

LICENSE

MIT.

Dependencies

~1.5MB
~24K SLoC