funny simple ESOLANG
Brainfuck is a super simple {esolang}, designed in the 80s to have the smallest possible compiler.
It is based around an array of 30k byte-sized cells, and a pointer into that array (basically the index that the "brainfuck machine" is currently at). It can be helpful to think about the language as a little machine that runs on a track around 30k little whiteboards, where you can change the instructions the machine follows.
In brainfuck, code and data are stored seperatly, i.e. a Harvard Architecture vs. a Von Neumann Architecture.
There are 8 main operations, and a common ASCII representation of that code.
Instruction | Code | What it does! |
Increment Memory Pointer | > | Basically, moves the "brainfuck machine" to the right along the track of the memory array. |
Decrement Memory Pointer | < | Same as incrementing, but moving to the left. |
Incease value at pointer | + | Increases the value at the place the machine is. |
Decrease value at pointer | - | Decreases the value at the place the machine is. |
Start loop | [ | This tells the brainfuck machine to start a loop. It doesn't do anything to the current memory cell, or the position the "machine" is, but it will when you close the loop |
End/Check loop | ] | When the brainfuck machine hits this, it will check if the current value (number on the whiteboard), and if it's not zero, start the instructions back at where you started the loop |
Read character in | , | The machine will write the ascii value of an inputted character on the current cell. |
Output character | . | Write the current cell out as the ascii character represented by the number. |
incoming(1) | fucc