Binary but also Brainfuck but also neither (BBABBAN)
Binary but also Brainfuck but also neither or BBABBAN for short (pronounced βbaˈβbən) is an esolang where, as the name says, it's related to both binary concept and brainfuck in a way where it actually doesn't. It was created by User:Batata.
Elements Overview
Here are the symbols you will usually see on BBABBAN programs.
Symbol | Meaning |
---|---|
[ | Start program. |
] | Terminate program. |
~ | Input received by the program. |
' | Indicates letters. |
" | Indicates symbols and numbers. |
# | Add text or number to variable/string. |
@ | Indicate uppercase letters. |
$ | Print variable, string or normal text. |
! | "If" condition. |
? | "Else" condition. |
{ | Loop start. |
} | Loop end. |
´ | Set variable or string to ___. |
NOTE: Symbols like +, - and () appear in codes with their normal functions.
Format
Binary Special Format
Unlike the classic binary format, BBABBAN uses a binary table system. For example, if you want to print the letter "H", the code SHOULDN'T BE:
[ $'01001000 ]
Given the fact that 01001000
is "H" in binary. Instead, you must use a table of 26 numbers, where 25 of them are 0s and one is 1. The 1 should be in the same position of the specific letter in the alphabet. So, as "H" is the 8th letter in the alphabet, the correct program should be:
[ $'00000001000000000000000000 ]
The same table system is applied to numbers, but not symbols. In the case of numbers, the table should have 10 numbers instead of 26. For example, if you want to print the number 7, the code should be:
[ $"0000000100 ]
But if you want to simply print "!", the program is:
[ $"! ]
Note: because of this table system, the esolang is not practical enough to be considered turing complete.
Distinct Print Functions
One of the special print features is that you can print a chain of letters, numbers and symbols using a string. So, to print the word "Potato", you could use the code:
[ #'00000000000000010000000000 #'00000000000000100000000000 #'00000000000000000001000000 #'10000000000000000000000000 #'00000000000000000001000000 #'00000000000000100000000000 $# ]
Another interesting feature is the use of spaces and empty lines to create a better output. For example, to print the following text:
A B C D
You could use the following program:
[ #'10000000000000000000000000 #" #'01000000000000000000000000 #" #'00100000000000000000000000 #" #'00010000000000000000000000 $# ]
Note that #"
prints a space and the following print function should create another text line:
#"
Compression Property
Like a brainfuck program, a BBABBAN code can be compressed to one or a few lines. For example, instead of using a huge code to print the word "Potato", you could alternatively use:
[#'00000000000000010000000000#'00000000000000100000000000#'00000000000000000001000000#'10000000000000000000000000#'00000000000000000001000000#'00000000000000100000000000$#]
Variable/String Characterization
To use a second, third, fourth etc. variable or string, you can use multiple "#" with the purpose of characterization. For example, if you want to make a program that adds variable 1 to variable 2 and then prints the result, you can use:
[ $#+## ]
Loops
A loop program looks like this:
number of loops{code}
So, for example, the following program prints the number "1" 5 times:
[ 0000010000{$"0100000000} ]
Note: when there is no loop end, the loop loops forever.
Examples
Print "Hello, world!"
[ #'@00000001000000000000000000 #'00001000000000000000000000 #'00000000000100000000000000 #'00000000000100000000000000 #'00000000000000100000000000 #", #" #'00000000000000000000001000 #'00000000000000100000000000 #'00000000000000000100000000 #'00000000000100000000000000 #'00010000000000000000000000 #"! $# ]
Compressed version:
[#'@00000001000000000000000000#'00001000000000000000000000#'00000000000100000000000000#'00000000000100000000000000#'00000000000000100000000000#",#" #'00000000000000000000001000#'00000000000000100000000000#'00000000000000000100000000#'00000000000100000000000000#'00010000000000000000000000#"!$]
Cat
[ $~ ]
Compressed version:
[$~]
Truth-machine
[ !~="0 ] !~="1 { $"1
Compressed version:
[!~="0]!~="1{$"1