Brain4Ever

From Esolang
Jump to navigation Jump to search

Brain4Ever is a Branflakes derivative created by User:LEOMOK. It was inspired by other Branflakes derivatives, as well as other programming languages.

Instructions

The language operates on a tape of signed, unbounded integers, infinite on both sides, each initialized with 0. There is also a backup cell. Some instructions require an argument, e.g. 12/ divides the current cell by 12. Use the raised minus ¯ to right a negative number. If no argument is given, the value in the memory cell is used.

   Basic Arithmetic And Tape Manipulation
   :  - Print cell value.
   .  - Print cell value mod 65536 as Unicode character.
   ;  - Input decimal number or arithmetic expression into cell.
   ,  - Input Unicode character into cell.
   "  - Print the string going from here to the next unescaped ". Valid escape codes are \\ (backslash), \" (double quote) and \n (newline).
   n\ - Set the input/output base to n, e.g. 2\ will start printing numbers in binary. Error if over 36 or under 1
   n< - Move the pointer back by n.
   n> - Move the pointer forward by n.
   n# - Set current cell to n.
   '  - Set current cell to Unicode value of the character before.
   n+ - Add n to current cell.
   n- - Subtract n.
   n* - Multiply by n.
   n/ - Divide by n.
   n% - Modulo n.
   n^ - Raise to the power of n.
   n& - Bitwise and.
   n| - Bitwise or.
   n_ - Bitwise xor.
   !  - Bitwise not.
   n$ - Bitwise select. Taken from INTERCAL.
   n~ - Bitwise mingle. Also taken from INTERCAL.
   ¿  - Set to random integer between 0 and cell value.
   (  - Set backup cell to current cell.
   )  - Set current cell to backup cell.
   [  - Inserts a new cell before the current pointer, shifting all following cells to the right.
   ]  - Removes the cell at the current pointer, shifting all following cells to the left.
   Control flow and functions
   {  - Code block start.
   }  - Code block end.
   ?  - If cell != 0 then {codeblock} else {codeblock} (else is optional)
   @  - While cell != 0 do [codeblock]
   [A-Za-z] - If followed by codeblock, define functiom, else run function
   Multiverse time travel