Wasm
Worst ASseMbly. Brainfuck with names, written out one word per line, or as bits.
jan Gamecuber, 2022 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
jan Gamecuber made Wasm in 2022 to be a semi-realistic assembly language that still sucks to program in. The name stands for Worst ASseMbly. Its first eight commands are brainfuck's, so it is Turing complete for the same reason. The other eight move or count by six, read and print whole numbers, and add an If that runs its block once.
Read the story
Every command has a name and a four-bit code, and a program can be written either way. The cells hold whole numbers without a bound, and the tape runs on without end.
The machine
| Code | Word | Does |
|---|---|---|
0000 0001 | Right Left | Move one cell |
0010 0011 | Inc Dec | Add or take one |
0100 0101 | OutUnicode InUnicode | Print or read a character |
0110 0111 | While EndWhile | Repeat while the cell is not 0 |
1000 1001 | Right6 Left6 | Move six cells |
1010 1011 | Inc6 Dec6 | Add or take six |
1100 1101 | OutNum InNum | Print or read a number |
1110 1111 | If EndIf | Run the block once if the cell is not 0 |
Words are split by white space and their case does not matter. The table also gives each code as one hex digit; this implementation reads the bits only. The cat has a fifth bit at the end of its bytecode; this implementation drops a last group short of four bits is dropped. At the end of the input both reads give 0.
Example
The truth-machine prints the number it reads, and then keeps printing it while it is not 0.
The truth-machine prints the number it reads, and then keeps printing it while it is not 0.
Six times seven, with Inc6 to fill the counter and Inc6 Inc to add seven each time round.
The Hello World in bytecode. Read as brainfuck it is >++++++++[-<+++++++++>]<.>>+>-[+]++>++>+++[>[->+++<<+++>]<<]>-----.>->+++..+++.>-.<<+[>[+>+]>>]<--------------.>>.+++.------.--------.>+.>+., 140 commands. It clears a cell with -[+], which needs no wrapping, and it ends with a line feed.
The same program in words takes 140 lines, one command each, and runs the same 813 steps.
Patterns it teaches
- Turing tarpit: brainfuck under longer names.
Further
See also
Wasm builds on Brainfuck.
Brainfuck derivatives
Cell-based
Write your own in Run Convert a program from Wasm
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: wasm.
Command line
shib run wasm -e '1101 1100 0110 1100 0111' --input '0'shib manual wasmSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/wasm.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org