NS!

From Esolang
Jump to navigation Jump to search

NS! (or Number Stack!) is a stack-based esoteric language made by User:Zopium that focuses on numbers. It is case-sensitive, so if you enter something like 3a*3+#, it wont print the 33rd ASCII character (!).

Commands
Command Purpose
0, 1, 2, 3, ... D, E, F Pushes the number onto the stack.
? Asks for user input, if it returns NaN, it wont push the value to the stack.
+ Pops the two values from the stack, adds them together, and pushes the result onto the stack.
- Pops the two values from the stack, subtracts them together, and pushes the result onto the stack.
* Pops the two values from the stack, multiplies them together, and pushes the result onto the stack.
/ Pops the two values from the stack, divides them together, floors the result, and pushes the result onto the stack.
% Pops the two values from the stack, divides them together, and pushes the remainder onto the stack.
P Pops the two values from the stack, raises the first to the power of the second, and pushes the result onto the stack.
^ Pops the two values from the stack, does a bitwise XOR with the values and pushes the result onto the stack.
& Pops the two values from the stack, does a bitwise AND with the values and pushes the result onto the stack.
| Pops the two values from the stack, does a bitwise OR with the values and pushes the result onto the stack.
> Pops the two values from the stack, right shifts the first value's bits by the second value and pushes the result onto the stack.
< Pops the two values from the stack, left shifts the first value's bits by the second value and pushes the result onto the stack.
# Pops a value from the stack and prints an ASCII character with that value.
$ Basically the same as #, but after the value is popped, it gets pushed back in.

Examples

Hello, World!

98*#AA*1+#AB*2-#AB*2-#AB*1+#4A*4+#48*#A9*3-#AB*1+#AB*4+#AB*2-#AA*#3A*3+#

XKCD Random Number

5A*2+#

Program to sing "The ABC Song"

Why you may ask? Well, for fun I guess.

6A*5+$48*#1+$48*#1+$48*#1+$48*#1+$48*#1+$48*#1+$4A*4+#
48*#1+$48*#1+$48*#1+$48*#1+$
48*#1+$4A*5+#1+$4A*5+#1+$4A*5+#1+$4A*5+#1+$4A*4+#
48*#1+$48*#1+$48*#1+$4A*4+#48*#
1+$48*#1+$48*#1+$4A*4+#48*#
1+$48*#1+$4A*4+#48*#1+$48*#
AA*3-#BA*#AA*#48*#
1+#77*3-#
A$#
99*3- 
#AB*1+$8+#48*#7A*3+#48*$3*B+$3+$1+$8+#48*#AB*1-$C+#48*$2*1+$48*#1+$48*#1+$ 
FF+F+3++#
77*3-#A#
99*3-#AA*1+$F4++$4-$48*#$B-$4+$8-$2/6-#48*#AC*1-$8-$1-$3/3+$3*1- 
#48*$2*B5*+2+$A-$6+#
48*#AB*5+$A-$5+$7-$3/2-$2*FF+FA+++$E-$B+$C-#48*#BA*1-$8-#88*1-#

Links