Firstreplace

From Esolang
Jump to navigation Jump to search

Firstreplace is an accidental1 esoteric programming language made by Abyxlrz.

(1) It is accidental because i was trying to make a interpreter for the esolang slashes in the programming language smilebasic, but i didn't know how to make all instances of a specific pattern get replaced (the interpreter only replaces the first instance of that pattern).

Syntax

The syntax of Firstreplace is very simple. It is similar to slashes' syntax but instead of slashes there are newlines and only the first instance of a specific pattern is replaced. Also the program isn't self modifying, it only modifies the initial state of the program.

It is also possible to allow the program to take input from you. You need to just type [INPUT] in the place of the pattern or replacement, but not the initial state.

Initial state
Pattern
Replacement
Pattern
Replacement
...

Example

Test
es
eses
Output: Tesest


ababab
ab
cd
Output: cdabab

Interpreter

I, finally wrote my own interpreter. If you have smilebasic 4 then you can download the interpreter.(you can enter the public key 4JDNE22HE)