Varnand
Variables and NAND. Every letter of Hello World is built from two hexadecimal digits.
DoggyDogWhirl · Turing complete: no · ●●○ moderate · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
DoggyDogWhirl named Varnand after "var" and "nand". The plan was a language whose only operation is NAND. But a literal is a single hexadecimal digit, so it can only say 0 to 15, and NAND on 8 bits only reaches values up to 15 or from 240. No letter lives there. So there is a second operation, a rotation, which moves a digit up into the high half of the byte.
Read the story
There are no loops. A program runs once from left to right, so Varnand is not Turing complete.
The machine
Commands come before their arguments, in Polish notation, and every command returns its value.
| Code | Does |
|---|---|
! a b | NAND of a and b |
% a b | Rotate a left by b bits |
O a | Print a as a decimal number |
P a | Print the character with code a |
I | Read one character |
= v a | Set the variable v to a |
0-9 A-F | A value from 0 to 15 |
a-z | A variable, 0 at the start |
Every other character is a comment. Values are 8 bits wide, so !00 is 255.
Example
Hello World ORs a rotated high digit with a low digit for each letter.
Hello World ORs a rotated high digit with a low digit for each letter. !!%44%44!88 is 0x40 OR 0x08, which is H. The two l and the o are kept in the variables l and m and printed again later.
The specification also has an adder of 37 lines. It builds a full adder out of NANDs and runs it once for each of the 8 bits, so 1 (0x31) and 2 (0x32) give c (0x63).
Further
Ideas it shows
See also
Also in Turing tarpits
Write your own in Run Convert a program from Varnand
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: varnand.
Command line
shib run varnand -e 'O2'shib manual varnandSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/varnand.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org