We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Brainlove

From Esolang
Jump to navigation Jump to search

Brainlove is another extension of the brainfuck language.

Description

Brainlove adds a few more commands to brainfuck in order to make it easier to program in.

Commands

(Assuming ptr is a pointer to a char array and str is a char variable.)

Command C translation
>
++ptr;
<
--ptr;
+
++(*ptr);
-
--(*ptr);
.
putchar(*ptr);
,
*ptr = getchar();
[
while(*ptr) {
]
}
(
while(!*ptr) { /* loop while *ptr == 0 */
)
}
~
break; /* break from the most inner loop */
$
str = *ptr; /* store *ptr in storage, taken from Extended Brainfuck Type I */
!
*ptr = str; /* return from storage, taken from Extended Brainfuck Type I */

Examples

Not function (0 becomes 1 and 1 becomes 0)

-[++~]

if(value != 0) {STUFF}

[STUFF~]

if(value == 0) {STUFF}

(STUFF~)

Swap two values who are next to each other (uses one extra cell)

$>>!<$<!>>$<!>