$replacement

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

$replacement is an esolang made by User: A() which was inspired by A=B.

Syntax

The only command is a$b which replaces a with b. Like with A=B, there are keywords:

Keywords

Keywords
Keyword Disc
[halt] halts program.
(string)a$b if the whole string is the character 'a' replace it with b
(once) do only once
(end) end of string
(start) start of string

Programs

Hello, world

$Hello, world![halt]

Not gate

1$0[halt]
0$1[halt]

(Binary) And gate

(string)11$xx1[halt]
(string)10$xx0[halt]
(string)01$xx0[halt]
(string)00$xx0[halt]

(Binary) Or gate

(string)11$xx1[halt]
(string)10$xx1[halt]
(string)01$xx1[halt]
(string)00$xx0[halt]

Addition

//input a
a$V
//input b
b$IIII
//Replace five I's with V
IIIII$V
//Replace four I's with IV
IIII$IV
//Replace 2 V's with X
VV$X
//Replace IVV with IX
IVV$IX
//Replace XXXXX with L
XXXXX$D
//Replace LL with C
LL$C
//Replace CCCCC with D
CCCCC$D
//Replace DD with M
DD$M

without comments:

a$V
b$IIII
IIIII$V
IIII$IV
VV$X
IVV$IX
XXXXX$D
LL$C
CCCCC$D
DD$M

XKCD Random Number

$4