esolang

ferNANDo

A program is only variable names. How many there are on a line decides what the line does.

Whtspc, 2009 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 4 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hi

The idea

ferNANDo was made by Whtspc in 2009. Every word is a variable holding one bit, and the only operation is NAND. There are no keywords at all, so with careful names a program reads like a poem; the Hello World is written in the words ave and terra.

Read the story

Any other gate follows from NAND. O A A is NOT, O A B then O O O is AND, and chained half adders count.

The machine

Every variable starts at 0. The count of words on a line picks the command.

WordsDoes
A B CA becomes B NAND C
A BA becomes A NAND B
8 wordsPrint the byte their bits spell, most significant bit first
9 words R A B C D E F G HRead a byte into A to H; R is 1, or 0 at the end of the input
1 wordIf it is 1, jump back to just after the last identical one-word line

Any other count is an error. ? reads as a random bit until something is written to it; in this implementation the generator is fixed, so every run gives the same bits. This follows the Python interpreter 0.5, the one Try It Online runs.

Example

The first line sets the variable named 1 to 1 NAND 1 of two zeros, which is 1.
Expected: meow

The first line sets the variable named 1 to 1 NAND 1 of two zeros, which is 1. The variable 0 stays 0, so the next two lines spell H and i. The second program is a cat; it loops on R for as long as there is input.

Further

Ideas it shows

Also in Turing tarpits

Write your own in Run Convert a program from ferNANDo

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run fernando -e '1 1
0 1 0 0 1 1 1 1
0 1 0 0 1 0 1 1'
shib manual fernando

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/fernando.js

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

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