📜 ⬆️ ⬇️

Malbolge: Programming from Hell

Good time of day, Habrabschestvo.

In my time, I suffered from this nonsense, tracking the emergence of various esoteric programming languages ​​and caught me the well-known Malbolge to all of us. That's what I want to tell about him. Well, let's start with.

And let's start with the fact that the notorious BrainFuck did not even lie next to it - such this Malbolge is cool and complex. The first code in this language was written not by people, but by another program written in Lisp, and then only two years after the appearance of this language.
But let's talk about hell programming in Malbolg. Firstly, it works in the ternary notation, which is important, for understanding the code that should be entered into the interpreter.

Malbolge has three registers: a, c, and d. Register c is the code register used as a pointer to the current command. Register d is the data register used to manage data. Register a is a battery, also used by some commands to manipulate data.
')
There are 8 teams in Malbolge. The machine determines which command to execute as follows: the value of the cell with the address c ([c]) is added to the value c, and the command is the remainder of dividing this number by 94 if [C] is not in the range from 33 to 126 inclusive.

But the actual list of commands:

After each instruction is executed, it is encrypted using the Crazy operation.
The operation is analogous to bitwise operations — it applies to the two corresponding digits.

Operation crazy:
CRZ 2-  0 1 2 1-  0 1 0 0 1 1 0 2 2 2 2 1 


After the instruction is executed, it is transferred to a special table:
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 5z]&gqtyfr$(we4{WP)H-Zn,[%\3dL+Q;>U!pJS72FhOA1CB6v^=I_0/8|jsb9m<.TVac`uY*MK'X~xDl}REokN:#?G"i@ 


We have dealt with the basics in grief in half, it's time to write the code.

But here, it turned out to be a bummer: no matter how hard I tried, I could not write a working program in this language.
Therefore, I give examples of cool hackers of smart people who succeeded.

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


and this one too:
 ('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@> 


On this, in fact, that's all. And if you still manage to write at least something on Malbolge, be sure to let me know - I want to take a photo with a genius.

Source: https://habr.com/ru/post/169455/


All Articles