diff --git a/book/SUMMARY.md b/book/SUMMARY.md index 2670aa3..0be88d1 100644 --- a/book/SUMMARY.md +++ b/book/SUMMARY.md @@ -146,6 +146,18 @@ * [Conclusion](languages/brainfuck/conclusion.md) * [Some interesting facts](languages/brainfuck/misc.md) + +* [Malbolge](languages/malbolge/README.md) + + * [Introduction](languages/malbolge/intro.md) + + * [History](languages/malbolge/history.md) + + * [Advantages](languages/malbolge/advantages.md) + + * [Disadvantages](languages/malbolge/disadvantages.md) + + * [Conclusion](languages/malbolge/conclusion.md) ## End diff --git a/book/languages/brainfuck/disadvantages.md b/book/languages/brainfuck/disadvantages.md index e373bcf..9a9108c 100644 --- a/book/languages/brainfuck/disadvantages.md +++ b/book/languages/brainfuck/disadvantages.md @@ -8,4 +8,4 @@ inefficiently. Albeit low abstraction level, Brainfuck is memory and CPU time in so it's not very viable to write anything in bare Brainfuck and you'd be better off by using some kind of Brainfuck assembler, or HLL to brainfuck compiler, but none of the listed can beat pure C implementation instead of Brainfuck one. -Finally, the language is a bit limited - I/O is limited to console input and output, greatly reducing use cases. +Finally, the language is a bit constrained - I/O is limited to console input and output, greatly reducing use cases. diff --git a/book/languages/malbolge/README.md b/book/languages/malbolge/README.md new file mode 100644 index 0000000..dd30562 --- /dev/null +++ b/book/languages/malbolge/README.md @@ -0,0 +1,6 @@ +# Welcome + +> This chapter has been authored by Krzysztof Szewczyk "Παλαιολόγος". + +Welcome to the Malbolge chapter! I'd like to let you know a bit more about +this amazingly difficult language. diff --git a/book/languages/malbolge/advantages.md b/book/languages/malbolge/advantages.md new file mode 100644 index 0000000..4f5a0a8 --- /dev/null +++ b/book/languages/malbolge/advantages.md @@ -0,0 +1,18 @@ +# Advantages + +Generally speaking, currently, Malbolge is a joke language. Therefore, it's not very efficient, nor easy to write. + +First of all, like all esoteric languages, it's a really good exercise for your brain! If Malbolge was Go of programming, Brainfuck +would be chess, and Assembly would be checkers. + +Malbolge is really simple! It won't take long to learn it. + +There were attempts to use Malbolge in a few real world cases, including encryption! Just think what if some critical encryption +algo would be implemented in Malbolge, and it would be **very** fast because of it's simplicity - it would take long, long time +to discover how it's implemented. + +Finally, Malbolge is not language that machines can eaisly generate, therefore it's really secure language. Imagine writing +Malbolge program displaying some kind header (copyright, program name, etc.). No one probably wouldn't even attempt to touch +the code! + +There are a few Malbolge hackmes, that weren't solved **to this day**! diff --git a/book/languages/malbolge/conclusion.md b/book/languages/malbolge/conclusion.md new file mode 100644 index 0000000..6cb8a3f --- /dev/null +++ b/book/languages/malbolge/conclusion.md @@ -0,0 +1,13 @@ +# Conclusion + +Malbolge was meant to be a joke language, but fiddling with it to find real world use case is **not** waste of time +(unlike brainfuck), due to cryptographical possibilities! + +Thinking about Malbolge in real terms is a bit risky, it's always quicker and easier to program other languages. Malbolge +doesn't really differ in problem it's solving with other esoterIc languages, it was already mentioned in Brainfuck chapter, + +Like with most esoteric languages, to play around with Malbolge you need basically no experience - basic knowledge of maths and +decent imagination are going to be sufficient. + +Summing around disadvantages and advantages - Malbolge is impractical as heck and it's dangerous to consider Malbolge real +language. But there's nothing bad in playing with it, trying to find real world use cases! diff --git a/book/languages/malbolge/disadvantages.md b/book/languages/malbolge/disadvantages.md new file mode 100644 index 0000000..161f84f --- /dev/null +++ b/book/languages/malbolge/disadvantages.md @@ -0,0 +1,10 @@ +# Disadvantages + +Malbolge is esoteric language. It was created as a joke. There are a few so-called Brainfuck hackers around, but being honest, +You can't earn a living programming in Malbolge these times. + +Malbolge is way too impractical to be using language in real-world cases (even more than Brainfuck!). Developers would cost way +too much and work really inefficiently. Albeit low abstraction level, Malbolge is memory and CPU time inefficient, +so it's not very viable to write anything in bare Malbolge and you'd be better off by using some other language. + +Finally, the language is really bounded - I/O is limited to console input and output, greatly reducing usability. diff --git a/book/languages/malbolge/history.md b/book/languages/malbolge/history.md new file mode 100644 index 0000000..0d60dfd --- /dev/null +++ b/book/languages/malbolge/history.md @@ -0,0 +1,14 @@ +# History + +Malbolge was invented by Ben Olmstead back in 1998. First Malbolge program was written in 2000, but it wasn't written by human - it +was generated by a beam search algorithm implemented in Lisp. + +Later, Lou Scheffer posted a few of his works regarding Malbolge and provided a `cat`-like to copy its input to its output. He also +mirrored the original interpreter and specification after the original site went down, and offered a general strategy of writing +programs in Malbolge as well as some thoughts on its Turing-completeness. + +Olmstead believed Malbolge to be a linear bounded automaton. There is a discussion about whether one can implement sensible loops +in Malbolge, it took many years before the first non-terminating program was introduced. + +Hisashi Iizawa proposed first "99 bottles of beer" application in 2005. He also proposed a guide for programming in Malbolge +regarding it's usefulness software protection. diff --git a/book/languages/malbolge/intro.md b/book/languages/malbolge/intro.md new file mode 100644 index 0000000..2ae0622 --- /dev/null +++ b/book/languages/malbolge/intro.md @@ -0,0 +1,26 @@ + +# Introduction + +Malbolge is one of the most popular esoteric programming languages, named after the eighth circle of hell in Dante's Inferno, the +Malebolge. + +Malbolge was specifically designed to hurt. It's almost impossible to use, because of crazy operation, self encrypting code and +base-three arithmetic. It's way more difficult than other esoteric languages (such as Brainfuck), but takes this difficultness to +the extreme. Despite this design, it is possible to write useful Malbolge programs. Malbolge is **not** Turing complete, there was +attempt to create Turing complete variant of Malbolge, named Malbogle Unshackled. + +Classic "Hello, world!" program looks bizzare in Malbolge: + +```malbolge +(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc +``` + +Technically speaking, Malbolge is machine code for so called Malbolge Virtual Machine. It has three registers - `a`, `c`, and `d`. +When a program starts, the value of all three registers is zero. It doesn't support stack and indefinite memory access out of the +box either. The virtual machine has 59,049 memory locations that can each hold a ten-trit ternary number, making memory access +limited consequently removing possibility of Turing completness. There were attempts to prove Malbolge Unshackled Turing +completness. [Brainfuck interpreter in Malbolge Unshackled](https://github.com/KrzysztofSzewczyk/Brainfuck.MB) was written to do +so. It can be proven using simulation way (which was described in Brainfuck chapter). + +Malbolge is an amazingly difficult language. One needs still to understand where it would be more suitable, and where it doesn't +particularly excel at.