'1066'
Functions of one bit, written in Chinese characters. Even Hello World comes out one bit at a time.
PythonshellDebugwindow, 2020 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
PythonshellDebugwindow made 1066 in late 2020. A program is made of CJK ideographs and line breaks and nothing else. Fourteen ideographs are commands; every other ideograph from U+4E00 to U+9FFF can be part of a name.
Read the story
There are only two values, 0 and 1, and only one literal, 乣, which is 0. A 1 is written 乣乢, NOT 0. A program is a list of functions that take bits and return a bit. On the way they can read bits of input and write bits of output. Text goes in and out as the bits of its UTF-8 bytes, highest bit first, so printing one letter takes eight output statements.
The machine
A function reads 兄param 九name 丫 assignments outputs value 乞. The program runs the function 冖.
| Command | Does |
|---|---|
九 丫 乞 | Start a function, end its name, end the function |
兄p | A parameter before 九, or an argument before a call |
name儳value墎 | Set a variable; the value 卯 reads one bit of input |
value吇 | Append one bit to the output |
也name | Call a function and take its return value |
乣 | 0 |
x乢 | NOT x |
x习y x乡y | AND, OR |
x凹y | y if x is 1, else 0 without looking at y |
All operators have the same precedence and work left to right. Output leaves as soon as it holds one whole UTF-8 character or 32 bits. At the end of the run the rest is padded with zeros to whole bytes. The return value of 冖 is the exit code. There are no loops; a function repeats by calling itself.
Example
A Hello World.
A Hello World. Each 乣吇 writes a 0 and each 乣乢吇 a 1. The main function writes H and e, then calls 矕 twice for ll; the other functions write the rest, a line feed at the end.
The truth machine reads eight bits into 一 to 八. The last bit of 0 is 0 and of 1 is 1, so it hands 八 to 矕, which writes 0011000 and then the bit itself. On 1, 邟凹兄邟也矕 calls 矕 again for ever.
Seven bits, 0100100, are not a character yet. At the end a zero pads them to 01001000, which is H.
A cat reads and writes eight bits and calls 冖 again. The run ends with an error when the input runs out.
Patterns it teaches
- Encoding tricks, with text as a stream of bits and code as ideographs.
Further
See also
CJK
Write your own in Run Convert a program from '1066'
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: 1066.
Command line
shib run 1066 -e '兄邟九矕丫乣吇乣吇乣乢吇乣乢吇乣吇乣吇乣吇邟吇邟凹兄邟也矕乞
九冖丫一儳卯墎二儳卯墎三儳卯墎四儳卯墎五儳卯墎六儳卯墎七儳卯墎八儳卯墎兄八也矕乞' --input '0'shib manual 1066Source
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/1066.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org