Brainfu*k interpreter and REPL written in Rust🦀
Find a file
2022-10-15 20:13:34 +01:00
.github/workflows feat: workflow to run tests on PRs and push to master 2022-10-15 06:54:04 +00:00
.idea Improve the arguments 🦀 2022-10-13 18:47:28 +02:00
archpackage Update the AUR package 😆 2022-10-13 21:13:26 +02:00
assets [ImgBot] Optimize images 2022-10-13 18:53:41 +00:00
screenshots [ImgBot] Optimize images 2022-10-13 18:53:41 +00:00
src Improve the repl 🥰 2022-10-13 19:58:02 +02:00
test_code added a test code 2022-10-15 01:49:58 +05:30
.gitignore Improve gitignore file 🥰 2022-10-08 08:16:21 +02:00
.gitmodules Create the AUR package 🥰 2022-10-13 21:06:00 +02:00
Cargo.toml Just up the version 🤍 2022-10-13 21:08:39 +02:00
LICENSE-MIT.txt Add WTFPL license 🤪 2022-10-13 17:18:07 +02:00
LICENSE.txt Add WTFPL license 🤪 2022-10-13 17:18:07 +02:00
README-ar.md File Renamed to README-ar.md 2022-10-15 20:12:54 +01:00
README.md Add files via upload 2022-10-15 20:13:34 +01:00

brainfuc*k interpreter

brainfuck interpreter: a simple brainfuck interpreter and REPL writen in rust 🦀

Features

  • Run brainfuc*k code from a file 💫
  • Run brainfuc*k live code from the REPL 🚀
  • Support utf-8 characters including emojis 😍 (optional)
  • You can control in the array size 📏

Install

  • from crates.io
    cargo install bfy
    
  • From aur:
    yay -S bfy
    

Options and arguments

Options table
Option Description Default
-h, --help Prints help information
-V, --version Prints version information
-f, --features The extra features to enable
Possible values:
  • no-reverse-value:
    If the value is you want decrement the value and the value is 0, don't set the value to 255, otherwise decrement the value.
    If the value is you want increment the value and the value is 255, don't set the value to 0, otherwise increment the value. The alias are: `nrv`
  • reverse-pointer:
    If the pointer at the end of the array, set the pointer to 0, otherwise increment the pointer.
    If the pointer at the beginning of the array, set the pointer to the end of the array, otherwise decrement the pointer. The alias are: `rp`
  • allow-utf8:
    Allow the use of utf8 characters (32 bit), otherwise only 8 bit characters are allowed.
    Use this feature with caution because it increases the cell size from 8 bits to 32 bits.
    It also allow you to use the emoji in your brainfuck code :D, This is if you can preserve your mind so that you can access their digital value :).
    The `u32` in rust can only store values from 0 to 4294967295, but we can only use 0 to 1114111 (0x10FFFF) for now. The alias are: `utf8`
n/a
-a, --array-size The size of the array 30000
-w, --without-tiles Dont print the tiles (e.g. exit code, file name, etc)
Help option output
bfy --help
Brainfu*k interpreter and REPL written in Rust

Usage: bfy [OPTIONS] [SOURCE]

Arguments:
  [SOURCE]
          The brainfuck source code file to run (if not will be entered in REPL mode)

Options:
  -f, --features <FEATURES>
          Possible values:
          - no-reverse-value:
            If the value is you want decrement the value and the value is 0, don't set the value to 255, otherwise decrement the value. If the
            value is you want increment the value and the value is 255, don't set the value to 0, otherwise increment the value. The alias are:
            `nrv`
          - reverse-pointer:
            If the pointer at the end of the array, set the pointer to 0, otherwise increment the pointer. If the pointer at the beginning of the
            array, set the pointer to the end of the array, otherwise decrement the pointer. The alias are: `rp`
          - allow-utf8:
            Allow the use of utf8 characters (32 bit), otherwise only 8 bit characters are allowed. Use this feature with caution because it
            increases the cell size from 8 bits to 32 bits. It also allow you to use the emoji in your brainfuck code :D, This is if you can
            preserve your mind so that you can access their digital value :). The `u32` in rust can only store values from 0 to 4294967295, but we
            can only use 0 to 1114111 (0x10FFFF) for now. The alias are: `utf8`

  -a, --array-size <ARRAY_SIZE>
          The brainfuck array size
          
          [default: 30000]

  -w, --without-tiles
          Dont print the tiles (e.g. exit code, file name, etc)

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information

Examples

bfy test_code/hello_world.bf
Hello world!
Successfully ran brainfuck source code from file: test_code/hello_world.bf
Exiting with code: 0
bfy -w test_code/hello_world.bf
Hello world!
bfy test_code/print_hi_yooo.bf
Hi yoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!Successfully ran brainfuck source code from file: test_code/print_hi_yooo.bf
Exiting with code: 0
bfy -w test_code/print_hi_yooo.bf
Hi yoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!
bfy test_code/like_cat.bf

output

Note: The output is not the same as the current version of the interpreter, but it is the same as the output of the interpreter when I wrote the code.

REPL

bfy # REPL mode

print @ and A in the repl

TODO

  • Add more tests
  • Add more examples
  • Create the brainfuck formatter
  • Add syntax highlighting in the REPL
  • Add auto completion in the REPL
  • Support dynamic array size feature

Resources