Mathlang

From Esolang
Jump to navigation Jump to search

Mathlang is an esolang made by User:Esolang lover123 for fun. it's based on mathematical symbols and functions. see the commands section for more info.

Commands

symbol function example mathatical name
pushes the value to the left to the stack A≤ less than or equal to
pops the top value of the stack and outputs it A≤ ≥ greater than or equal to
duplicates the value one down from the top value {if there is only one value it duplicates it} A≤ √ ≥ %= root
% it's obvious... it represents the top value of the stack of course! A≤ √ ≥ %= percent
+ takes 2 numbers on the stack and adds them

1≤ 2≤ + gives 1+2 which is 3.

plus
- takes 2 numbers on the stack and substract them 0≤ 3≤ - gives 0-3 which is -3 minus
⋅ or × or * multiply 5≤ 4≤ ⋅ gives 20 multiply
÷ or / or : divide 20≤ 3≤ ÷ gives 6 because it's it rounds down divide
0123456789 push corresponding number on stack numbers/digits/numerals/etc.
A-Z variables. [must be uppercase] A≤ 2≤ ⋅ 3≤ - variables
= gives a value to a variable.
if its written as [=[variable]]  the program will print that variable as a number [[variable]=] for ascii character
3≤ 5≤ ⋅=A sets A to 15 equals
> and < they are Booleans for less and greater than [true=1 false=0] A B< or B A> tests if A<B less than and greater than
user input. the rest is like = Q≤ Q≈ almost equals
() loops if previous statement is true else goes to the next pair of parentheses and loops that {if there are no parentheses after then just run the code like normal} go to the truth machine parentheses
[] just like () but it keeps checking if the boolean is true or not. this allows for repeats and other stuff X≤ X=1 X<5[1≤ +] brackets
{} allows for comments {comment} squiggly brackets
halts the program not equals
labels: ≫x jumps to ≪x ≫x ≪x way greater than
is a place to jump to ≫≪ way less than
! is a not A<B! factorial
f() allows you to define functions {use little x to be replaced with numbers/variables f(x)=(x≤ 1≤ +) f(2)=3 function
≺ and ≻ right roll stack and left roll stack respectively.

Examples

These examples uses the old infix-prefix-mixing version. If you know how to understand and fix it, go and do it.

Hello, world!

A≤
B≤
C≤
D≤
E≤
F≤
G≤ 
H≤
I≤
A=h {idk the ascii values someone smarter than me can do that}
B=e
C=l
D=o
E=w
F=r
G=l
H=d
I=!
{the next part prints the text}
A=
B=
C=
C=
D=
E=
D=
F=
G=
H=
I=

False machine

≈T
T<1(2<3(=0))(=1≠)

Cat program

1<2(T≈ T=)

Deadfish interpreter

I≤ X≤ X=0
≪a 
≈I
I=1 (1≤ + ≫a) 
I=2 (1≤ - ≫a)
I=3 (X≤ ⋅ ≫a)
I=4 (=X ≫a)
I=5 (≠)

Plushie-completeness Proof

P≤
L≤
C≤
P=2
L=4
C=31
=L
=C

±

{boolean}(+)(-)

Implementations

none i think