Self-modifying esolang

From Esolang
Jump to navigation Jump to search

Self-modifying esolang is the title created by User:ResU in 2021.

Commands

insert.command(insert.command(x,3),2)

Inserts the command insert.command(x) at line 2, which inserts the command x at line 3.

append.string(x,defaultVariable)

Appends x to the end of defaultVariable. defaultVariable is the default variable.

goto.line(defaultVariable)

Goes to the defaultVariableth line.

if.(condition).happens { }

Does everything between the brackets if a condition happens.

store.(expression).to.(defaultVariable)

Equivalent of defaultVariable=expression.

"text"

Prints the text. If the text is a variable, print the variable.

a=

Initializes a. Every variable can be initialized except for defaultVariable.

ask.for.input(defaultVariable)

Asks for input and stores it to defaultVariable.

define.function(name.of.function, parameters)

Defines a function with the name name.of.function.

Hello, world!

"Hello, world!"

Quine

define.function(a, b) {
"b"b")"
}
a("define.function(a, b) {
"b"b")"
}")

Infinite loops

goto.line(1)
goto.line(3)

if.(1=1).happens { goto.line(1) }

Truth machine

a=
ask.for.input(a)
if.(a=0).happens {
"0"}
if.(a=1).happens {
"1"
goto.line(4)}

Fibonacci sequence

C is the number of Fibonacci numbers to print.

a= b= c= d=
store.(1).to.(a) store.(1).to.(b) store(100).to.(c) store(2).to.(d)
"a" "b"
if.(b<=a).happens {
store(a+b).to.(b) store(b).to.(a) "b" store(d+1).to.(d)
goto.line(4)}

Interpreters

No interpreters yet.