Dis
Malbolge with the encryption taken out, which leaves it merely extremely painful.
Ben Olmstead, 1998 · Turing complete: with unbounded memory · ●●● hard · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Ben Olmstead made Dis in 1998, the same year as Malbolge, and meant it to walk the line between impossible and just painful. It keeps Malbolge's machine: 59049 cells of ten trits, a code pointer and a data pointer that both move on after every instruction. It drops the parts that make Malbolge hostile. Instructions are not decoded before they run and not encrypted after.
Read the story
What is left is still hard. The only arithmetic is a trit by trit subtraction without borrow and a rotation, both of which also overwrite the cell they read. Since the data pointer moves on every step, the data an instruction uses is wherever the pointer happens to be.
The machine
| Char | Does |
|---|---|
! | Halt |
* | d becomes [d] |
^ | Jump: c becomes [d] |
> | Rotate [d] one trit right; a gets the result too |
\| | [d] and a become a minus [d], trit by trit |
{ } | Print a as a byte, or halt if a is all twos; read a byte into a, all twos at the end |
Anything else does nothing. Whitespace and (comments) are not loaded.
Example
The author's cat, without its comments.
The author's cat, without its comments. * sets d to 42, the code of *, and ^ jumps through the ! at cell 43 to cell 34, where }{ reads and writes a byte. At the end of the input } reads all twos, and { halts on them.
The Hello World by Pro465. Every | subtracts the data at the end of the program from a, and every { prints a.
Further
Ideas it shows
See also
Self-modifying
Cell-based
Write your own in Run Convert a program from Dis
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: dis.
Command line
shib run dis program.txtThe program is long; save it as program.txt first.
shib manual disSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/dis.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org