Replacefuck

From Esolang
Jump to navigation Jump to search

Replacefuck is a Brainfuck derivative based around pre-processing made by User:TieSoul in 2014.

Language overview

Replacefuck is based around pre-processing. Namely, before the actual program, you can define 'functions'. Those functions are defined in this manner:

ZERO:[-]
PLUSn:+n

Functions must be defined on separate lines, which is to say, with a linefeed character between them. Additional newlines are not allowed. Variables in functions must be at the end of the function name. Variable n in the PLUS function of the example replaces iself and the character before it with n copies of the character before it, essentially multiplying the character that comes before it by n.

The program itself is also defined as a function PROG, and cannot contain any Brainfuck code, and must consist solely of function calls and comments, like this:

PLUSn:+n
COPYnp:[>n+>p+<n<p-]
OUTPUTALL:+[>.]
PROG:PLUSfPLUSfPLUSfPLUSfPLUSf COPY11 OUTPUTALL

This outputs ––––––KK, twice ascii number 75. Numbers you can use for functions in the PROG function are single-digit hexadecimal numbers: 0-f.

Computational class

Translation from Brainfuck easy; Turing-complete.

External resources