FuckBrain

From Esolang
Jump to navigation Jump to search

Creator and Name

FuckBrain is a language that adds spacetime travel to brainfuck that was written by User:Esolang1. The language Timefuck is very similar to FuckBrain, but FuckBrain allows to run more than one characters while traveling spacetime. The name symbolizes the spacetime traveling feature of the language. (E1-0002)

Instructions

    > Moves the pointer right
    < Moves the pointer left
    + Adds 1 to current cell
    - Subtracts 1 from current cell
    . Prints the current cell value as an ASCII character
    , Gets an ASCII character and saves it to current cell
    [ Jump to the matching ] if current cell is 0
    ] Jump to the matching [ if current cell is not 0
    # A marker for the start of spacetime travel
    ( Run commands up to matching } in the spacetime of matching ! (First {...} is matched with first !, and on)
    ) A marker for the end of spacetime travel

I/O

The commands . and , allow ASCII character I/O, same as brainfuck.

Memory Structure and Code Structure

While memory structure is identical to brainfuck, the code structure is a little bit different when spacetime travel is used. The following example code demonstrates the code flow of spacetime travel mechanism.

   A#B#(C)(D)E

This code will run A, B in order, and then run C in the spacetime of the first #. Then, D will run in the spacetime of the second #. After two spacetime travels, E will run and terminate the program. Because the (...) command is not a loop, the following code is legal.

   A#[B(]C)

This code will first run A, and then enter a loop. Then, after B is executed for the first time, the code ]C will run as in the spacetime of #. This means that the program closed a loop before entering it. How these kinds of program will run is completely up to the compiler (as of now).

Examples

How FuckBrain simulates the grandfather paradox

Interpreters or Compilers

Unfortunately, there are no interpreters built for this language now. If there was an interpreter, it will use more memory than most other brainfuck derivatives, since the spacetime of every single command in the code has to be saved.