Teleporto

From Esolang
Jump to navigation Jump to search

Teleporto is a esolang where commands teleport to one anther.

Each line starts with a number (or an equation that becomes a number), when the line ends, they teleport to the line of that number (if the equation has changed due to a variable use the new value of the equation).

Commands:

Command Description
~(x) chose random number in set {1,2,...,x}
$(x) print x
#(x) variable x
@(x,y) change variable x to y
?(exp;code) run code if exp
` number is user's choice

math/Boolean commands:

Command Description
x+y x+y
x-y x-y
x*y x times y
x/y floor(x divided by y)
x%y x modulo y
x^y x^y
(exp1)&(exp2) exp1 and exp2
(exp1)|(exp2) exp1 or exp2
!(exp) not exp
x=y x=y
> x is greater than y
< y is greater than x

It is probably possible to make a compiler for this.

note: $(x) can be a multivariable function instead. For example you could use $(x,y,r,g,b) to indicate that the pixel located at (x,y) should be changed to rgb (r,g,b), you can also put strings in $() but not outside of it

Syntax

Code is all stuck together except for the exp. at the start which has a space separating it from the rest of the equation.

you could also use the number at the start to indicate a block of code (indented) to be processed as a line

line numbers start at 1, use a jump to line 0 to exit the program

numbers must be integers

variables start at 0

Programs

hello world:

0 $("Hello world")

looping counter:

2 @(1,#(1)+1)@(3,#(1))
#(2) ?(#(3)=0;@(2,1)$("\n"))?(!(#(3)=0);@(2,2)@(3,#(3)-1)$("*"))

cat program:

1 $(`)

truth machine:

2 @(1,`)@(2,0)?(#(1)=1;@(2,2))
#(2) $(#(1))

XKCD challenge:

0 $(4)

Programing methods

while loop:

a while can be made as follows:

#(1) @(1,1)?((condition);@(1,2))(code)

functions:

a function can be made as follows:

#(1) @(2,f(#(3),#(4),...,#(n)))

set #(1) to whatever line will be used next

set #(3),#(4),...,#(n) to whatever the inputs are

variable #(2) is the output