nori.io

From Esolang
Jump to navigation Jump to search

This wiki page is VERY outdated, please click here while we update it, don't actually read this wiki page.

nori.io is a short stack-based esolang made by User:Mkukiro named after a stray cat they found

The interpreter reads the program left-to-right, character per character, and always moves right.

Commands

The interpreter ignores every other character than these, making them no-op.

Main commands

nori.io arithmetic is TOS × NOS

Command Description
> Push the value next to it
< Pop the last value
N Push the numeric user input
I Push the user input
, Push the user input as an ASCII value
O Output the last value to the console then pop it
. Output the last ASCII value to the console then pop it
@ Swap the last two values
$ Reverse the whole stack
: Duplicate the top value
+ Add last two values together, leaving only the result
- Subtract last two values together, leaving only the result
* Multiply last two values together, leaving only the result
/ Divide last two values together, leaving only the result
^ Raise last two values together, leaving only the result
z Square root the last value, leaving only the result
% Modulo last two values together, leaving only the result
c Ceil the last number
f Floor the last number
r Push a random number
W Set the IP position to 0 (wrap around the program)

Example programs

There are actually a bunch more (hello world, truth-machine, etc…) but they include commands that aren’t here yet

Cat program

IO

Numerical cat program

NO

Simple adder

NN+O

Square area

This programs asks user input for the length of a square's side

>2N^O

Rectangle area

This programs asks for the width and height of a rectangle

NN*O

Weird looking thing

Warning: flashing lights

This kinda looks like a DNA when run in a fullscreen terminal

rOW

Add and Subtract

NN+N-O

Turing Completeness proof

Even as early as version 1.2 nori.io can be proven to be Turing Complete by User:Olus2000. It is possible to translate a cyclic tag program with initial data of 1 into a nori.io program by encoding cyclic tag data queue as values on the stack and productions in the source code.

Queue encoding

Cyclic tag data queue is encoded as a binary number with the front of the queue at low bits and back at high bits, and another binary number with nth bit set, where n is the length of the queue. For example:

queue: 0b00101011010001110010
size: 0b100000000000000000000

The initial queue will always contain only a single 1 bit, so it will be encoded with a value-size pair of (1, 2), which will have to be input by the user.

Similar encoding will be used as a part of encoding productions.

Production encoding

Productions are encoded in the source code. Each production must be converted into its binary number + size pair, and inserted as number and size into its own copy of the following snippet:

:>2@%>6>8*+.

: >2@%
@$ >2 *+ :: >2@% @ >2@/f * @ >2@/f
$ @ == >number == *
+

:$@>2@%
== >size == >1@- *
>1+
*

>2@/f
:>1@-:%<$
>2@/f

This snippet prints the consumed bit and performs one step of the cyclic tag execution with the production given by number and size. IMPORTANT: Normally the queue is written starting from the front, so make sure to put front bits as low bits in your conversions.

Final program

The whole program should start with:

,
>6>8*@-$ 
>6>8*@-$

Followed by productions converted as described above and then end with:

>6>8*+$
>6>8*+$

W

The program should be run, and provided with input 21 and an endless stream of newlines. On each loop it will print the consumed bits. It will raise a "modulo by 0" error when data empties itself.

External resources