Malbnung

from Wikipedia, the free encyclopedia

Malbolge is a public domain esoteric programming language , which in 1998 by Ben Olmstead was developed. It was named after the eighth circle of hell from Dante's Divina Commedia .

The specialty of Malbenue is that it was designed to be the worst possible programming language , the most difficult to master. However, due to the limited memory, Malbole is only Turing-complete with slightly modified processing rules .

General

Proof of the difficult development of programs is that the first Malbendung program was only created two years after the programming language emerged. This program was not programmed by a human, but found by a program written in Lisp using a search algorithm . This search program was developed by Andrew Cooke.

There are several reasons that Malbenue is so difficult. The most important is that commands are replaced by other commands after they are executed. This makes it very time-consuming to implement loops in a painting sequence. Other factors that make programming in Malbsequence difficult include the fact that data words can only be manipulated in the ternary number system using a right shift and a very unusual operator. In addition, the coding of a command by an ASCII character depends on the position of the command modulo 94 and memory cells can only be initialized with one of eight possible ASCII values.

Nevertheless, Lou Scheffer managed to develop a program that copies its input to its output. His report ends with suggestions on how to make the language even more difficult to master.

Basic functionality of Malbenue

Malbammlung has three registers a , c and d and a memory of the size that can store a 10-digit ternary integer in each cell .

initialization

The source code is first filtered and read into the size memory without spaces or newline characters . The still available free memory is then coded with the crazy function: [m] = crz ([m - 2], [m - 1])

Pointer notation

The registers c and d contain memory addresses, with [c] and [d] the value stored at these addresses is designated.

Instruction set

Malbammlung has 8 command words . The current instruction is determined by adding the content of [c] and c and then calculating modulo 94. The result is then compared with the following values:

Commands
Result from
([c] + c)% 94
meaning Explanation
4th jmp [d] Set the instruction pointer c to [d] .
5 out a Output of the character whose ASCII value is stored in a .
23 in a Entry of a character whose ASCII value is stored in a . Enter is coded with 10 , end-of-file marking with 59048 .
39 rotr [d]
mov a, [d]
Right rotation of the number in [d] , d. H. the last digit of the ternary representation is appended at the front, the rest is shifted to the right. From 000211111 2 z. B. 2 000211111. The result is stored in both [d] and a .
40 mov d, [d] Copies the value from [d] to d .
62 crz [d], a
mov a, [d]
Applies the crazy function to the value of [d] and a . The result is then available in [d] and a .
68 nop Never mind.
81 end Terminates the program.
Every other value behaves like 68 .

After each operation, [c] is encrypted. Then c and d are increased by one.

Crazy function

The two transferred numbers are coded digit by digit according to the table. For example, from 0120120120 0001112220 crz, the number 1001022211 .

Crazy function
crz Input 2
0 1 2
Input 1 0 1 0 0
1 1 0 2
2 2 2 1

Encryption

After the instruction has been executed, but before c is incremented , [c] is permuted using a code table .

Hello, world

This Malbbey program prints " Hello, world. "

 (=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk**
 hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98\6543W10/.R,+O<

Other programs in Malbenue

In the meantime it is no longer a problem to write programs in sequence that only output a fixed string of limited length. The length of the string is limited because Malbolge programs cannot contain more than 59049 commands.

In addition to the above-mentioned cat program by Lou Scheffer (which takes advantage of a bug in the interpreter that enables memory cells to be initialized with non-ASCII characters), there are so far (as of December 2012) very few programs in Malbammlung that Bows included. One of them is another cat program, which, however, works without exploiting the interpreter bug. One of the most impressive programs in Malbenue should be a program released in 2005 that outputs the lyrics of the song " 99 Bottles of Beer " and uses nontrivial loops and conditional branches. The code of this program cannot be read by a human. Another program in Malbnung that works with nontrivial loops and conditional branches is a Quine , released in late 2012 .

Popular culture

Individual evidence

  1. Episode "Leviathan". Elementary . Episode 10, Season 1. CBS . December 14, 2012.

Web links