Brainfunc

A programming language like brainf*ck

2021/07/06

Shuz* (@shuzaei)

Language background

  • 🤔 C++ templates are Turing complete.
  • 🤔 Brainf*ck is also Turing complete.
  • 🤔 How about introducing functions into brainf*ck?
  • 😄 While-statements are substitutable with recursive functions and if-statements!

What is Brainfunc?

  • It is a derivative of brainf*ck.
  • There is a void function declaration in the language.
  • There is an operation () in the language, which means an if-statement.
  • There is no operation [] which means a while loop in brainf*ck in the language.

Sample code (an echo program)

# function main
_ {
    # input
    ,
    # if (input + 1 != 0) (<=> input != EOF)
    + ( -
        # print input
        .
        # continue echoing
        _
    )
}

Try it on Brainfunc visualizer now!

Commands

Command Description
x{y} Declare a function that executes y with the name x.
> < Increment and decrement the index of the current cell.
+ - Increment and decrement the value of the current cell.
, . Input to and output from the value of the current cell.
(x) Execute x if the value of the current cell is not equal to 0.
x Call a function with the name x.

See also: README.md

How can we enjoy Brainfunc?

  • Try coding on Brainfunc visualizer.
  • Install a Brainfunc compiler with a command below.
    brew install shuzaei/brainfunc/brainfunc
    • Usage: bcc <filename> [output filename]
  • Install a Visual Studio Code extension from here.

What are the merits and the demerits of Brainfunc?

  • ✔️ You can use functions and write brainfunc-like code more with ease.
  • ✔️ You can use if-statement without affecting surrounding cells.
  • ✔️ You can leave comments more formally and efficiently.
  • ❌ You can use only 63 functions in the current status.

Good luck with your life on Brainfunc!

Thank you for watching,

Shuz*

The history and release notes

  • 2021/06/25 Invented Brainfunc on the evening
  • 2021/06/25 Created the first transpiler
  • 2021/06/26 Created the first compiler
  • 2021/06/26 Released an alpha version of the package
  • 2021/06/26 Created the first visual studio code extension
  • 2021/06/27 Created the first homebrew package
  • 2021/06/27 Released a beta version of the package
  • 2021/07/02 Started to create a visualizer
  • 2021/07/03 Released an alpha version of the visualizer
  • 2021/07/05 Released a beta version of the visualizer

Links