esolang

Noobinary

Binary for noobs. Every command is a run of ones or a run of zeros, and the length of the run says which.

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

Tested with 2 known programs · Test method

Run it

Expected: Hello World!

The idea

Batmanifestdestiny designed Noobinary to look like Binary but be easier to learn. A program holds only the digits 0 and 1. A run of n ones is one of ten commands for the stack, the input and the output, and a run of n zeros is one of six that mark, jump or pop. A single 0 does nothing, so it sits between two runs of ones to keep them apart.

Read the story

The Hello World pushes only ones and makes each character with add, multiply and subtract. Some start from a character kept on the stack, so the W is the H plus 15.

The machine

Runs of ones.

RunDoes
1Push 1
11 111 1111 11111Add, subtract, multiply or divide the top two
111111Duplicate the top
1111111Pop and print it as a number, with a line feed
11111111Pop and print it as a character
111111111Push a byte of input, or -1 at the end
1111111111Stop

Runs of zeros.

RunDoes
0Nothing
00A loop tag
000Go back to the last tag if the top is not 0
0000Go back to the last tag if the top is 0
00000If the top is not 0, go back that many tags before the last tag
000000Pop

With no tag behind them 000 and 0000 go to the start of the program, and a computed jump to a tag that is not there ends the run. Spaces and line breaks do not end a run, as in the C implementation on esolangs.org, so a run may carry on over a line break. Values are 32-bit ints.

Example

The Hello World.

The Hello World. Seven of its 14 line breaks fall in the middle of a run.

A count down from 3. 1 0 1 0 11 0 1 0 11 makes 3 and 00 is the tag. Then 1 0 111 takes 1 off, 111111 0 1111111 prints a copy, and 000 goes back to the tag while the top is not 0. The specification counts down from 100 the same way and prints 99 down to 0.

Expected: 2 1 0

Input comes in as bytes, so an A is 65.

Expected: 65

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from Noobinary

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: noobinary.

Command line

shib run noobinary -e '101011010110101101011010110101101011010110101101111110111100101110111111011111110001111111111'
shib manual noobinary

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/noobinary.js

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

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