BrainSplited
- This is still a work in progress. It may be changed in the future.
- The title of this article is also called AsciiTape.
- The title of this article is also called Extended Brainfuck Programming Language(EBPL for short).
BrainSplited is designed by PSTF and his ChatGPT. It is extended Brainfuck.
My question and ChatGPT's answer
Q1: Can you invent an esoteric programming language, please? Make it Turing complete and use characters in ASCII chart.
A1: Certainly! Here's a whimsical esoteric programming language I'll call AsciiTape. In AsciiTape, the program operates on an infinite tape of ASCII characters, and the interpreter reads and manipulates the tape according to certain rules. Here are the basic components of AsciiTape:
AsciiTape Programming Language Specifications: Memory Tape: AsciiTape uses an infinite tape of ASCII characters as its memory. Each cell on the tape can hold a single ASCII character.
Instruction Pointer: The instruction pointer moves along the tape, interpreting and executing the commands.
Commands:
>: Move the instruction pointer to the right. <: Move the instruction pointer to the left. +: Increment the ASCII value at the current cell. -: Decrement the ASCII value at the current cell. [: Jump forward to the matching ] if the value at the current cell is 0. ]: Jump back to the matching [ if the value at the current cell is not 0. .: Output the ASCII character at the current cell. ,: Input a character and store its ASCII value in the current cell.
Example Program:
Here's an example AsciiTape program that prints "Hello, AsciiTape!":
++++++++[>++++>++++++>++++++++>++++++++++>++++++++++++<<<<<-]> >>++++++++.>>+++++.+++++++..+++.<<<----.<.>>-------.>>++++.------------- ---.++++++..<++++.>--------.+++++++++++++++.-----------.<<<<+.[>]<[[-]<]
Turing Completeness:
AsciiTape is Turing complete due to its ability to manipulate memory, perform conditional branching, and perform input and output operations. Interpreting AsciiTape:
To interpret AsciiTape, you would start at the first character of the tape and follow the commands as described above. The program halts when the instruction pointer reaches the end of the tape. AsciiTape is a quirky and challenging language to work with due to its unconventional tape-based structure. Have fun exploring the world of AsciiTape programming!
Q2: This programming language was invented by Urban Muller before 2000 and Urban Muller call it "Brainfuck". Can you expand it with more commands?
A2: Certainly! Brainfuck is indeed an esoteric programming language invented by Urban Müller in 1993. It is known for its minimalistic design, consisting of only 8 commands. However, we can expand the language by adding more commands to make it more versatile and fun to work with. Here are some additional commands we can introduce to Brainfuck to create an extended version:
Extended Brainfuck Programming Language Specifications: Memory Tape: The extended Brainfuck uses an infinite tape of memory cells, each capable of holding a single byte value (0-255).
Instruction Pointer: The instruction pointer moves along the tape, interpreting and executing commands.
Commands:
>: Move the instruction pointer to the right. <: Move the instruction pointer to the left. +: Increment the value at the current cell by 1. -: Decrement the value at the current cell by 1. [: Jump forward to the matching ] if the value at the current cell is 0. ]: Jump back to the matching [ if the value at the current cell is not 0. .: Output the value at the current cell as a byte. ,: Input a byte and store it in the current cell. *: Multiply the value at the current cell by the next byte value. /: Divide the value at the current cell by the next byte value (integer division). %: Modulo the value at the current cell by the next byte value. ^: Bitwise XOR the value at the current cell with the next byte value. &: Bitwise AND the value at the current cell with the next byte value. |: Bitwise OR the value at the current cell with the next byte value. ~: Bitwise NOT the value at the current cell. !: Invert the value at the current cell (0 becomes 1, non-zero becomes 0). ?: Generate a random number between 0 and the value at the current cell (inclusive) and store it in the current cell.
Example Program:
Here's an example extended Brainfuck program that calculates the factorial of a number input by the user:
,>++++++[<-------->-],[<+>-]<.
Turing Completeness:
The extended Brainfuck language remains Turing complete due to its ability to manipulate memory, perform conditional branching, perform arithmetic operations, and bitwise operations. By adding these additional commands, the extended Brainfuck language becomes more powerful and allows for a wider range of programming challenges and creativity. Feel free to explore the extended Brainfuck language and create interesting programs with it!
Commands
>: Move the instruction pointer to the right. <: Move the instruction pointer to the left. +: Increment the value at the current cell by 1. -: Decrement the value at the current cell by 1. [: Jump forward to the matching ] if the value at the current cell is 0. ]: Jump back to the matching [ if the value at the current cell is not 0. .: Output the value at the current cell as a byte. ,: Input a byte and store it in the current cell. *: Multiply the value at the current cell by the next byte value. /: Divide the value at the current cell by the next byte value (integer division). %: Modulo the value at the current cell by the next byte value. ^: Bitwise XOR the value at the current cell with the next byte value. &: Bitwise AND the value at the current cell with the next byte value. |: Bitwise OR the value at the current cell with the next byte value. ~: Bitwise NOT the value at the current cell. !: Invert the value at the current cell (0 becomes 1, non-zero becomes 0). ?: Generate a random number between 0 and the value at the current cell (inclusive) and store it in the current cell.
Example(written by myself)
Hello, World!
++++++++++++>++++++<*. +++++++++++++++++++++++++++++++++. +++++++. . +++. >[-] ++++++</-->----<* ++++++++++++. ------------. [-]>[-]< ++++++++++++>++++++++++<*+++++++++. --------. +++. ------. --------. [-]>[-]<
Cat program
,[.,]
A+B
>,[-------------------------------->+<[>>+++++++++ [>>> [<+>->[>]>[>]+[<]<[<]>]<< [->+<<]<- ]>>>[>]+[>]<-<[<]<<<<---------------- [>>>>>[>]+[<]<<<<-] >>]>[->>>>[-<<<<<+>>>>>>]<<<<+>>]<<-<,]>>>>>[-<<<<<+>>>>>>]<<----------<<<< [ [<]>->[>]>>+ [>[+<-]<[->---------<<]>+>[<-]<[->---------->>+<]>] >[<<<]< ] >>>>[>>>]<<<[>+++++++>++++++<*<[+>-<].<<<]