Wasm
Jump to navigation
Jump to search
Paradigm(s) | imperative |
---|---|
Designed by | User:jan Gamecuber |
Appeared in | 2022 |
Memory system | tape |
Computational class | Turing complete |
Reference implementation | Unimplemented |
Influenced by | brainfuck, Assembly languages |
File extension(s) |
WASM, an acronym for Worst ASseMbly is a Turing-complete brainfuck derivative made by jan Gamecuber to be a semi-realistic assembly language that still sucks to program in. This language uses a theoretically infinite tape of unbounded integers to store data.
Commands
Bytecode | Name | Function |
---|---|---|
0000 or 0 |
Right |
Move the data pointer right 1. |
0001 or 1 |
Left |
Move the data pointer left 1. |
0010 or 2 |
Inc |
Increment the current cell. |
0011 or 3 |
Dec |
Decrement the current cell. |
0100 or 4 |
OutUnicode |
Output the current cell as Unicode. |
0101 or 5 |
InUnicode |
Take 1 character input and store its Unicode value in the current cell. |
0110 or 6 |
While |
While the current cell is not 0 … |
0111 or 7 |
EndWhile |
Close the while block. |
1000 or 8 |
Right6 |
Move the data pointer right 6. |
1001 or 9 |
Left6 |
Move the data pointer left 6. |
1010 or A |
Inc6 |
Increment the current cell by 6. |
1011 or B |
Dec6 |
Decrement the current cell by 6. |
1100 or C |
OutNum |
Output the current cell as a number. |
1101 or D |
InNum |
Take input and store it in the current cell. |
1110 or E |
If |
If the current cell is not 0 … |
1111 or F |
EndIf |
Close the if block. |
This language is turing complete, as the first 8 commands are the same as in brainfuck.
Examples
Hello World!
To print “Hello World!” in the assembly language, employ
Right Inc Inc Inc Inc Inc Inc Inc Inc While Dec Left Inc Inc Inc Inc Inc Inc Inc Inc Inc Right EndWhile Left OutUnicode Right Right Inc Right Dec While Inc EndWhile Inc Inc Right Inc Inc Right Inc Inc Inc While Right While Dec Right Inc Inc Inc Left Left Inc Inc Inc Right EndWhile Left Left EndWhile Right Dec Dec Dec Dec Dec OutUnicode Right Dec Right Inc Inc Inc OutUnicode OutUnicode Inc Inc Inc OutUnicode Right Dec OutUnicode Left Left Inc While Right While Inc Right Inc EndWhile Right Right EndWhile Left Dec Dec Dec Dec Dec Dec Dec Dec Dec Dec Dec Dec Dec Dec OutUnicode Right Right OutUnicode Inc Inc Inc OutUnicode Dec Dec Dec Dec Dec Dec OutUnicode Dec Dec Dec Dec Dec Dec Dec Dec OutUnicode Right Inc OutUnicode Right Inc OutUnicode
The same effect can be achieved in the bytecode version using
0000 0010 0010 0010 0010 0010 0010 0010 0010 0110 0011 0001 0010 0010 0010 0010 0010 0010 0010 0010 0010 0000 0111 0001 0100 0000 0000 0010 0000 0011 0110 0010 0111 0010 0010 0000 0010 0010 0000 0010 0010 0010 0110 0000 0110 0011 0000 0010 0010 0010 0001 0001 0010 0010 0010 0000 0111 0001 0001 0111 0000 0011 0011 0011 0011 0011 0100 0000 0011 0000 0010 0010 0010 0100 0100 0010 0010 0010 0100 0000 0011 0100 0001 0001 0010 0110 0000 0110 0010 0000 0010 0111 0000 0000 0111 0001 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0100 0000 0000 0100 0010 0010 0010 0100 0011 0011 0011 0011 0011 0011 0100 0011 0011 0011 0011 0011 0011 0011 0011 0100 0000 0010 0100 0000 0010 0100
Cat program
An infinite cat program would assume the following design in the assembly language:
Inc While InUnicode OutUnicode EndWhile
The bytecode variant comprehends
0010 0110 0101 0100 01111
Truth-machine
A truth-machine in the assembly variant resolves to
InNum OutNum While OutNum EndWhile
The bytecode version constitutes
1101 1100 0110 1100 0111
Interpreter
- Common Lisp implementation of the WASM programming language.