esolang

nya~rgs

Every command is one character, its arguments split by colons, and a full stop to end it.

Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 5 known programs · Test method

Run it

Expected: Hello World

The idea

nya~rgs keeps its data in numbered addresses that hold strings or integers. A command is one character followed by its arguments and a full stop, and a line can hold as many commands as it likes. Whatever comes after a full stop and is not a command is skipped, so a comment needs no marker.

Read the story

Jumps name a line and a character on it, both counted from 0. A loop is a jump back to the exact column where its body begins. A string cannot hold the argument separator, so the colon in a prompt is written /;.

The machine

CommandDoes
'a:text.Store a string; \n is a line feed, /; a colon
^a:n.Store an integer
@a.Print the value, with no line feed
;a.Read a line of input
+a:n. +>a:b.Add the number n, or the value at b
>a:b:c.Store 1 at c if the value at a is bigger than at b, else 0
\|l:c.Go to line l, character c
?l:c:a:b.Go there if the values at a and b are equal
_Halt

The string 5 and the integer 5 count as equal. The examples also use -, * and / like +, &a. to turn a string into an integer and =a:b. to append one value to another. They also use <n., which the specification never explains; this implementation skips it.

Example

The Hello World stores the text at address 0 and prints it.

The Hello World stores the text at address 0 and prints it.

The example for >. It says the program prints 1, since 2 is bigger than 1.

Expected: 1

The input mod 2 halves the number, rounding down, doubles it and takes that from the input.

Expected: Input: 1

The truth machine prints the prompt, the input and a line feed, then jumps to character 36, the second @0., while the input equals 1. On 0 it stops after one line.

Expected: Enter Number: 0

Patterns it teaches

  • Encoding tricks: jumps aim at a column, so moving one character moves every loop.

Further

Also in Turing tarpits

Write your own in Run Convert a program from nya~rgs

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: nya-rgs.

Command line

shib run nya-rgs -e ''\''0:Hello World.@0.'
shib manual nya-rgs

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/nya-rgs.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org