esolang

BIITI

Assembler names on a Forth machine, and not one of them does what it says.

DolphyWind, 2024 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello World!

The idea

DolphyWind made BIITI in 2024, after 8086 assembly and Forth. The name stands for Beauty Is In The Implementation. A program is a list of lines that look like assembler, but the specification warns that its 21 commands do not do what you think. MOV pushes, ADD duplicates, MUL compares, SUB jumps and JE prints.

The machine

A stack of values, each a string, a whole number or a float. ACC holds one more value and starts at 0. CMP holds the last comparison, which is Less, Equal, Greater or NoCmp. Lines are numbered from 1.

CommandDoes
MOV xPush a string or a number
JNEDrop the top
JL JG JLE CMPSum, difference, product, ratio of the second and the top; JL also joins strings
MULCompare the second with the top into CMP
SUB nJump to line n
JGE PRINT RTRSkip the next line on Equal, on Less or Greater, on Greater
POP DUP PUSHSkip the next line on Greater or Equal, on Less, on Less or Equal
JMP DIVPop into ACC; push ACC
JEPop and print
ADDDuplicate
ROTRead a line of input
INDEXRotate the top three, so the top goes third
READPush the character of a string at an index

Example

The truth machine reads its input, prints it and compares it with 1.

The truth machine reads its input, prints it and compares it with 1. PRINT skips the jump back when the two differ, so on 0 the program runs off its end. On 1 SUB 2 sends it back to the duplicate on line 2, and it prints 1 forever. Counted from 0, line 2 would be the print, and the duplicate after it would find an empty stack.

Expected: 0

The counter keeps its limit in ACC and counts from 0 up to it. RTR skips the jump back once the count has passed the limit. The empty fourth line is where SUB 4 lands.

Expected: 0 1 2 3

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from BIITI

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run biiti -e 'MOV "Hello World!\n"
JE'
shib manual biiti

Source

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

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

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