Numbers

From Esolang
Jump to navigation Jump to search

Numbers is a work-in-progress stack-based esoteric programming language created by User:Xorol.

Instructions

An interpreter made by Xorol can be found here Interpreter

Numbers currently has 15 instructions:

Numbers' Instructions
Cmd Description
1 Pushes the following value onto the stack
2 Pushes the sum of the top two values on the stack and removes the addends
3 Pushes the difference of the top two values on the stack ( a - b )
4 Pushes the product of the top two values on the stack and removes the factors
5 Pushes the quotient of the top two values on the stack ( a ÷ b ), and then pushes the remainder
6 Pops the top value on the stack
7 Skips the next instruction if the top value on the stack is zero
8 Jumps to the instruction with the number of the next value
10 Prints the stack onto the screen, with newlines between the values
60 Reverses the stack
61 Swaps the top two values on the stack
90 Takes input from the user as an integer
91 Takes input from the user as a character
101 Prints the stack as ASCII values
102 Prints the top value on the stack
103 Prints the top value on the stack as a character
~ Halts the program

Example programs

Hello, world!

The Hello World! program pushes each letter's corresponding ASCII values onto the stack, then prints the stack as a string

1 72 1 101 1 108 1 108 1 111 1 32 1 87 1 111 1 114 1 108 1 100 1 33 101

Truth-machine

The truth-machine takes input from the user, if it is a "1" it outputs "1"s indefinitely, if it's a "0" it outputs a singular "0"

91 7 8 8 102 ~ 102 8 7

Digital root calculator

It takes input from the user, and calculates the digital root using the formula 1+(n-1)%9. It takes advantage of the fact that the division instruction also pushes the remainder onto the stack.

1 1 90 3 1 9 61 5 61 62 1 1 2 102