By any measure, there is an enormous number of programming languages. Some lists contain hundreds, while the Historical Encyclopedia of Programming Languages lists just under 9,000. You’ve probably only used a handful, and you might not be too surprised to discover that many of the rest are obscure, archaic, and just plain bizarre.
Find out quite how strange programming can get, from languages full of brackets to those that interpret color or even code you cannot see at all!
### Lisp: Everything Is a List
Lisp is an old language, possibly the second-oldest still in use today. It first appeared in 1960. The language’s name stands for “list processing,” but a common alternative nickname, poking fun at its unique syntax, is “lots of irritating superfluous parentheses.” It’s easy to see how it gained this name.
Lisp is the last serious language on this list, included because of its unusual paradigm and its status as the original AI language.
### Prolog: Logic and Natural Language Programming
Prolog uses a declarative style, where programs describe the structure and logic of a task rather than the process of how to accomplish it. Prolog does the rest, taking these rules and producing programs that use them.
This approach enables a particular type of programming focused more on logic and natural language than control flow and algorithms.
A Prolog program consists of facts like:
“`prolog
child(john, sue).
“`
And rules like:
“`prolog
parent(Y, X) :- child(X, Y).
“`
These make up a knowledge base you can then interrogate with queries such as:
“`prolog
?- parent(sue, john).
“`
This should return `true` to indicate that, yes, Sue is the parent of John.
Prolog is particularly well-suited to solving logic puzzles like the Towers of Hanoi or the classic river crossing puzzle with a wolf, goat, and cabbage. It’s another language that can be difficult to get your head around; once you do, though, it’s easy to recognize its beauty and influence.
### Befunge: The Language with Two-Dimensional Source Code
Befunge is a classic example of an esoteric programming language—one that cares more about its artful abuse of language design than its practicality. Using Befunge is a challenge, requiring a combination of logical thought and creative interpretation. Ultimately, it introduces a light-hearted touch to the normally serious world of programming.
While many languages are line-oriented, and a rare few—like Python—also care about code indentation and column placement, Befunge takes this to the extreme. The code consists of individual characters laid out in a grid, for example:
“`
0″! dlroW , olleH”v
> v | : v ^<
```
You can use postfix notation to manipulate the stack; the command `.` outputs the value at the top. A simple program that outputs the number 12 looks like this:
```
48+.@
```
Befunge includes commands to move the instruction pointer in various directions, read from standard input, and duplicate the top of the stack. There’s even a wonderfully specific “vertical if” operator!
### The Promise of Graphical, or Visual, Programming
Graphical programming languages veer in and out of fashion, with languages like Scratch aimed at the educational market. If one ever finds widespread success, it may owe it all to Befunge, which essentially uses the most basic form of graphical display: ASCII art.
### Piet: Programs as Abstract Works of Art
Piet takes inspiration from Piet Mondrian’s paintings, which combined black grid lines with blocks of primary color and became iconic pieces of 20th-century art. The Piet programming language produces beautiful source code with absolutely no resemblance to what it actually does.
Although the example below doesn’t quite imitate Mondrian’s style, a Piet program can be crafted to do so with some effort.
Behind the scenes, Piet is a bit like Befunge, with blocks of color representing movement in 2D space within the program. Each specific command is defined not by a particular color, but by the transition from one color to the next, according to changes in hue and lightness.
Needless to say, Piet is not an easy language to program in, but it is said that true art requires a form of suffering.
### Whitespace: Because It Makes You Feel Like a Spy
What do you think the following program does? Let’s make it a bit easier: how about the same program with all its text selected? Even then, it remains pretty difficult to decode—and that’s the point.
Welcome to Whitespace, a language whose programs consist entirely of spaces, tabs, and linefeed characters. You’ll want to learn how to show non-printing characters in your editor before you even begin experimenting with Whitespace.
For example, in Vim, you can use the `:set list` command to reveal whitespace characters, and ensure your editor doesn’t strip trailing whitespace when saving Whitespace files.
Apart from the idiosyncratic syntax, Whitespace shares many features with other esoteric languages: it uses a stack, supports a limited set of operations, and recognizes just integer and character data types.
Whitespace ignores all non-space characters, but it depends on characters that most other languages ignore. This means a Whitespace program can be embedded within the source code of an entirely different language. In fact, some of your existing programs might also be valid Whitespace code!
### Shakespeare: A Language the Bard Could Have Written
Hark here, use this language and thy source shall be as quaint as if it did spring forth from the bard’s pen.
In other words, Shakespeare is a programming language with source code that looks like it was written by William Shakespeare himself. This sounds unlikely, but here’s an example of a program that outputs "HI":
```text
// (Example omitted for brevity)
```
Shakespeare achieves much of what it does by giving plenty of freedom to the programmer to write in a pseudo-Shakespearean style. In the example, variables like Hamlet and Juliet are declared with “Enter.”
The phrase spoken by Juliet, beginning “Thou art,” is a computation based on the negativity of the adjectives and their number. “Speak your mind” is one way to output a value—in this case, the “H” in “HI.”
Like most esoteric languages, Shakespeare is hardly intended to be practical. But it’s a magnificent demonstration of just how varied programming languages can be, and how imaginative some language designers are.
### JSFuck: A Naughty Language That Works in Any Web Browser
This is by far the rudest of any programming language covered here—but only because a couple of others were left off this list!
JSFuck continues a tradition of expletives in esoteric language names that began with the original Brainfuck in 1993. The JS version is notable because it’s a subset of JavaScript, so you can actually run it in any web browser.
Why you would want to is another matter.
JSFuck is really an encoder, converting any reasonable JavaScript program into an unfathomable mess of code that uses only the characters `[`, `]`, `(`, `)`, `!`, and `+`.
It takes advantage of certain properties of JavaScript to carry out this miraculous transformation, but it does so with complete disregard for efficiency.
For example, the “Hello World” program in JSFuck takes up 3,039 characters. Here’s an excerpt for flavor:
```js
// (Excerpt omitted for brevity)
```
---
From lists of brackets to invisible code and colorful art, programming languages can be as strange and creative as human imagination allows. Whether practical or purely artistic, these unusual languages remind us that programming is not just a science, but also an art form.
https://www.howtogeek.com/weird-programming-languages-that-are-secretly-brilliant/
Be First to Comment