8ial
Eight instructions, sixteen registers of one byte each, and labels to jump to.
Ractangle, 2024 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Ractangle made 8ial, the 8 instruction assembly language, in 2024. It has sixteen registers that each hold one byte, and its only test is a compare and jump. The specification compiles Minsky machines to it, but a register holds no more than 255, so the language is not Turing complete. Input and output are whole numbers.
The machine
| Instruction | Does |
|---|---|
INC $r DEC $r | Add or take 1 from a register, which wraps |
PUT $r | Read a number into it |
OUT $r | Print it |
;name | Mark a label |
JMP name | Jump to the label |
CMJ $r v name | Jump to the label if the register equals v, a number or a register |
END | Halt |
Instructions and their operands are words separated by spaces or line breaks. The specification's grammar writes CMJ with the label first and its examples with the label last; this implementation reads both. Each number printed ends with a line feed.
Example
The A+B program moves the second number into the first one step at a time.
The A+B program moves the second number into the first one step at a time.
A numeric cat echoes numbers until it reads a 0.
A truth machine. It counts any other number down to 1 first, so only 0 halts.
Patterns it teaches
- Counter machines: increment, decrement and a test for 0 are enough for a Minsky machine, if only the counters had no end.
Further
See also
Stack-based
Write your own in Run Convert a program from 8ial
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: 8ial.
Command line
shib run 8ial -e ';repeat
PUT $1
OUT $1
CMJ $1 0 x
JMP repeat
;x END' --input '5 3 0'shib manual 8ialSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/8ial.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org