3x

From Esolang
Jump to navigation Jump to search

3x is a stack-based esolang. It is inspired mainly by 1+ in that 3 is the only literal. Stack items can be any rational number.

Commands

Command Meaning
3 Pushes 3 to the stack
x Pop A, B, and C, and push (A-B)/C
? Push 1 number from input
! Pop and print top of stack
v Pop A and B, store A in variable B
^ Pop A, push value of variable A (3 if unassigned)
# Swap top 2 items
(...) Loop while top value isn't 0 (like BF [])
[...] Print ...

Examples

Hello World

[Hello World]

Truth Machine

?([1])[0]

Multiply 2 Numbers (Note: Potentially incorrect, see discussion)

??3#v3333x3x3333x3x3^x(3#v3333x3x3333x3x3^x#3#v3^3^(3#v3333x3x3333x3x3^x#3#v3333x3x33333xx3^x#)#)!

Implementations

A Ruby interpreter by User:Bangyen.