YABFD

From Esolang
Jump to navigation Jump to search

YABFD is Yet Another BrainFuck Derivative. This makes it Turing Complete as it is a superset of brainfuck. This language was created after User:walksanator was bored after installing MineFuck (A fabric mod on modrinth) and found it to be slow and generally not working that well with minecraft redstone.

As YABFD is based on brainfuck it naturally has a array and pointer. but also comes with mutiple other arrays that can be swapped between,pointers, and If/If-Else blocks


Syntax

Instruction Description
> Move the pointer to the right
< Move the pointer to the left
+ Increment the memory cell at the pointer
- Decrement the memory cell at the pointer
. Output the character signified by the cell at the pointer
, Input a character and store it in the cell at the pointer
[ Jump past the matching ] if the cell at the pointer is 0
] Jump back to the matching [ if the cell at the pointer is nonzero
@ Open portal to another realm specified by the cell
| Puts the current realm number into the cell
_ Execute the realm-specific function
{ Opening bracket for a If block.
} Closing bracket for a If block
( Opening parenthesis for a Else block
) Closing parenthesis for a Else block
* Save cell location into pointer
% Save cell value into pointer
$ Either link to location in pointer or write value from pointer into the cell
^ Unlink a linked cell

Notes About If/If-Else blocks

After a { you need to put another symbol which specifies the condition

Symbol Condition
0 Cell value is = 0
@ Pointer is in the same realm as specified by the current cell
* Cell is a pointer to another cell
= The previous cell and this cell are equal
< The previous cell is less then this cell
> The previous cell is greater then this cell

Other random Notes

The If/If-Else block which is more than one character opening to create properly
Pointers redirect all actions taken on them to where they point to (except unlinking)
Whenever jumping realms you will always be at cell 0 regardless of where you were
The $ command doing different things based on the pointer value
The pointer starts with a value of 0
Pointer Notation is $<realm>:<cell> so a pointer to realm 1 cell 6 would be written as $1:6
Cells when unlinked copy the value of the target cell
When unlinking cells they copy the value from their linked cell before unlinking
Limited sized realms (TODO: allow overriding of `>` and `<` commands like done with `,` and `.`)

Examples

echo 6 times if a

+[-[---<]>>-]<- setup cell 2 to have the letter a
%[-]<<$ copy it to pointer then move it to cell 0
>, move to cell 1 and get input
{=......} if cells 0 and 1 are the same print the letter 6 times
(.) else print it once

Truth machine

(bit bigger then normal brainfuck but i like constants being near 0-index)

+++++++[>+++++++<-]> write '0' to cell 2
%[-]<<$ copy/move cell 2 to cell 0
>, get input
[-<->]< subtract cell 1 from cell 2
{0 +++++++[>+++++++<-]> if cell 1 =0 then write 1 to cell 2
[.]} then print infinietly
(>++++++[>++++++++<-]>.) else print 0 once


A working intepreter that has been made/is being worked on by User:walksanator is avaliable on github[1] although this language should be able to be implemented almost anywhere