3 (islptng)

From Esolang
Jump to navigation Jump to search

3 is a stack-based esolang that is just 1 with more commands and less constants.

Syntax

Totally 28 commands, they are 0134,.;:!=@~-_|+*/%^\?$![]<>

3 Pushes 3 to stack.
= Duplicates top value.
0 Rotates top 3 values(Take the 3rd to the 1st)
# Swaps top 2 value.
, Get a character from input. Pushes its ASCII value.
; Get a number from input and push it.
@ Halt.

Pop a value:
4 Waste it.
~ Sine it(radians).
- Negate it.
_ Floor it.
| Push absolute value of it.
1 Push its sign (1, 0 or -1)
. Prints it in character.
: Prints it in number.

Pop 2 values:
+ Addition.
* Multiplication.
/ Division. Divisor popped first.
% Modulo. Divisor popped first.
^ Power. Exponent popped first.
\ Root. Exponent popped first.

Controllers
?a$b! pop, if > 0, do a, else do b.
[a] while top value > 0 do a.

2nd stack
< Pop from 1st and push into 2nd.
> Pop from 2nd and push into 1st.

If you pops from an empty stack, it returns 3 instead of throwing a error.

Examples

Hello World

33/-3+3^33**.33^3*33^+33+33/+-+=.33+33/++===..3+=.33*3+33/-+333/+*=.33+3/33+33/-+^.33+3/*33/-+.=.3+.=.33+3/3^-+.33*3+33/-+=3*.33/-+.

Interpreter

Try it online!