From Esolang
Jump to navigation Jump to search
Paradigm(s) imperative
Designed by User:Stiathirs the Protogen
Appeared in 2022
Dimensions one-dimensional
Computational class Not applicable
Major implementations Implementation in JavaScript
File extension(s) .numsym

NumSym (short for NumberSymbol) is an esoteric programming language invented by User:Stiathirs the Protogen in 2022.


Each program consists of two parts, the code and the input buffer (input is defined before the program starts, and not requested on the fly). The code is made up of single character instructions, these instructions are the numbers 0-9 and various symbols (hence the name NumSym). NumSym is presumed to be Turing-complete (Turing-completeness untested).


Instruction Action
0-9 Pushes the number to the stack
^ Takes the next character from the input buffer and pushes its ASCII value to the stack. If there's no more input, pushes 0 to the stack.
! Duplicates the top value of the stack.
@ Reverses the order of the stack.
+ - * / % Pops the top two values from the stack and perform the operation on them, the top value being on the right side. Pushes the result to the stack.
; Pops the top value of the stack and discards it.
# Pops the top value of the stack and prints it as a number.
$ Pops the top value of the stack and prints it as its corresponding ASCII character.
< = > Pops the top two values and check if the left side is less than/equal to/greater than the right, the top value being on the right side. If the condition is true, pushes 1 to the stack, otherwise, pushes 0.
[ Starts a loop if the top value of the stack is not 0 (the value is not removed from the stack, use ; to discard it if not needed).
] Ends a loop. This is ignored if not in a loop.

Conditional Techniques

Using only the 3 conditional commands and 0, it is possible to recreate the effects of <=, >=, and !=.

Conditional Recreation
<= >0=
>= <0=
!= =0=


Hello World

98*!65*1- +!7+!!3+!25*1+32**1+-!62*-!25*1+5*+!64*+!3+!6-!8-!25*1+32**1+-0@[$]

Explanation: Pushes the ASCII values for all the characters in Hello, World! to the stack, pushes a zero to end the future loop, reverses the stack, then starts a loop to print all the characters.

Truth machine


Explanation: Takes in one character from the buffer and pushes its ASCII value to the stack, then pushes 49, the ASCII value for 1. The program checks if the user input is equal to 49. If it is, then 1 will be pushed to the stack, and the loop will begin. The loop duplicates the top of the stack (which holds a 1) and prints 1 to the screen, popping the duplicated 1 off the stack, leaving it where it started, then starts over. If the user input is 0 (or anything else for that matter), 0 will be pushed to the stack, and the loop will be skipped. The program then prints the 0 and terminates.

Cat program


Explanation: Takes in characters from the input buffer and prints them to the screen. Makes use of the behavior of ^ that causes it to push 0 whenever there's no more input.

99 Bottles of Beer


I don't remember how I made this, so no explanation, sorry! Also sorry for not putting it in a code block, but it wouldn't fit on the page!

- Stiathirs the Protogen


NodeJS (fast)

Online Interpreter (slow but plain JavaScript and web-based)