📜  malboge (1)

📅  最后修改于: 2023-12-03 15:17:31.549000             🧑  作者: Mango

Malbolge

Malbolge is a programming language that was designed to be extremely difficult to program in. It was created in 1998 by Ben Olmstead and is named after the eighth circle of hell in Dante's "Inferno".

Characteristics of Malbolge
  • Malbolge is a self-modifying language, where instructions are modified as they are executed.
  • Malbolge has no machine-readable specification, making it very difficult to write a working compiler.
  • The language uses a trinary (base-three) system of notation.
  • Malbolge code is intentionally obfuscated and difficult to read.
Examples

Here is an example of a "Hello, world!" program in Malbolge:

(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc

However, deciphering the above code is difficult, if not impossible. Here's the same program in a human-readable format:

(=<` # This sets up the read-eval-print loop
    # First instruction to execute is placed in codebox 0.
    # This puts "Hello, world!" string into the codebox
    "Hello, world!\n"
    # This is an inline comment
    # This takes characters from the above string one-by-one
    # and puts them into codebox 24, initially.
    # It also sets up the recursive access loop, executed
    # later
    v
        # This is the "exit" instruction, which comes in
        # later for the recursion. We jump here if we got
        # the character zero.
        (`'!dL\1(j.@/<$-k%*,+h#d{~\z]&y^>i;u:Qtsr8n-
        `9&5#3\"/x7a;]p$=`{V)u<[oFJ|fz2E^C_*^B^SD
    >
    # This instruction sets up the entry point to the
    # recursion routine
    ;Wv8k#C!&r$zm>P<\nJg)i'~|6_Y^XdT\$=U43@o%0a
    '''
    # This is the recursion loop
    '}!za2q#0Mx./l-h+Djfp|(yCK_wGrc%<e:$bVtS`u9@iN
    # This is a no-op instruction
    """
    # This sets the instruction pointer at the correct starting
    # address within codebox 0
    .
Conclusion

Malbolge is one of the most difficult programming languages to write in. It remains a purely research-oriented language, and has no practical applications.