esolang

Ichi

One instruction with one operand, and the sign, the parity and the size of that number each mean something.

TheCanon2, 2024 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 6 known programs · Test method

Run it

Expected: 7

The idea

Ichi is Japanese for one. TheCanon2 made it in 2024 as a one instruction language with fewer operands than Divmeq. A program is a list of integers, and each integer x is a whole instruction. Its parity picks one of two registers, its sign says whether to add or subtract 1, and half its size is the line to jump to. The jump is skipped when the register has just gone to -1, which is the only test there is.

Read the story

0, 1 and -1 are special. 0 and 1 print a register. -1 clears both registers and reads two numbers into them, and every program starts with an implicit -1.

The machine

Two unbounded registers, lines numbered from 1.

xDoes
0, 1Print register 0 or 1 and a space
-1Clear both, read two numbers into them
even xRegister 0 gets the sign of x added; jump to line |x| div 2, unless it is now -1
odd xThe same with register 1

Ichi has no character output. The Hello World in the specification prints the ASCII codes, 102 instructions to count up to each one.

Example

The A+B.

The A+B. Line 1 adds one to register 0 and jumps to line 2. Line 2 takes one from register 1 and jumps back to line 1, until register 1 reaches -1 and the run falls through to line 3. That one takes back the extra 1 that register 0 got and jumps to line 4, which prints it.

The truth machine and the Hello World.

Expected: 0
Expected: 72 101 108 108 111 44 32 87 111 114 108 100 33

Further

Ideas it shows

OISC

Write your own in Run Convert a program from Ichi

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run ichi -e '0'
shib manual ichi

Source

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

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

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