esolang

For The Worthy

Only 0 and 1 count. Every other character is a comment.

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

Tested with 5 known programs · Test method

Run it

Expected: Hello World!

The idea

For The Worthy reads the characters 0 and 1 and nothing else, so that programmers can reach what the specification calls their final "hackerman" form. A program is one stream of bits. Instructions are 4 bits, variables are named by 8-bit numbers and text is spelled out in 8-bit ASCII codes. The examples put spaces and line breaks between the fields, and they mean nothing.

Read the story

Under the bits it is an ordinary little language, with typed variables, if and else, a goto and expressions with 14 operations.

The machine

BitsDoes
0001Declare a variable, 01 boolean, 10 integer or 11 character, maybe with a value
0010Print text, a variable or an expression
0011Read input into a variable
0100 0110 0101If, else, end if
0111Go to the instruction with the next 16 bits as its number
1000Assign a value or an expression to a variable

An expression is an argument, a 4-bit operation and another argument. An argument starts with 3 bits for its kind, an expression, a variable, a boolean, an integer or a character. An integer is 17 bits, a sign bit and 16 more. The operations are + - * / %, AND, OR, XOR and six comparisons.

Example

Print, then the length 12, then 12 characters.

Print, then the length 12, then 12 characters.

The truth machine declares character variable 0, reads it and compares it with the character 0. On 0 it prints 0 and ends. On 1 it prints 1 and jumps to instruction 6, the print, forever. That jump only works if instructions count from 1.

Expected: 0

The specification also has a simple calculator. It reads a number, an operator and a number, and on 6, * and 7 it prints 42.

Further

Ideas it shows

Also in Hostile

Write your own in Run Convert a program from For The Worthy

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run for-the-worthy -e '0010 00 00001100 01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001'
shib manual for-the-worthy

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/for-the-worthy.js

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

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