首发于极光日报
20 种最奇怪的编程语言

20 种最奇怪的编程语言

简评:第一次遇到这些语言时,我下意识觉得有些程序员可能工作不饱和(微笑)。其实这些语言中有一些是为了特定目的而创建的,另一些则是在于挑战和娱乐。总之,非常羡慕这些又聪明又有时间的人了!

不多说,看看这 20 种编程语言有多奇怪 ~

▎20. reMorse

reMorse 语言旨在使代码看起来像莫尔斯码……(why?

reMorse 包含四条指令。dash( - )和 dasher( - 后跟空格)指令分别从七个操作的循环列表中选择下一个和上一个操作。dot(。)和 dotty(。后面跟一个空格)分别进行操作和正在选择的操作的相反操作。

以下是「Hello World」的 reMorse 语言未完成版本,由于太复杂,连作者都懒得写完 Hello World 的代码……

- - - ..- ...-.---.;newline
- - - .-. - ..-.- ...-. ---.;!
- - - ...- . . -.---.;d
----. . . -.---.;l
----. . -...---.;r
----. -...---.;o
----...-.- ..-. ---.;W
//author didn't feel like doing this part
-..............;output all characters

▎19. Omgrofl

现在社交网络上很多简写词汇,比如 lol, omg, brb, wtf 之类的。

所以有人就觉得用这些互联网缩略词作为命令是件很有趣的事……于是这门语言诞生了。一个典型的 Omgrofl 程序看起来就像十几岁青少年间的对话,所有的变量都是 lol, lool, loool 等形式。

以下是「Hello World」的 Omgrofl 语言版本:

loool iz lol
looooool iz lool
rtfm
 wtf looooool iz liek 0
  tldr
 brb
 lmao loool
 roflmao looooool
brb

▎18. ArnoldC

这是一门基于施瓦辛格的编程语言……

这个项目试图通过计算机科学的方式,发现终结者 T-800 的代码构成。

If BECAUSE I'M GOING TO SAY PLEASE
Else BULLSHIT
EndIf YOU HAVE NO RESPECT FOR LOGIC
While STICK AROUND
EndWhile CHILL 

以下是「Hello World」的 ArnoldC 语言版本:

IT'S SHOWTIME
TALK TO THE HAND "hello world"
YOU HAVE BEEN TERMINATED

▎17. Asciidots

Asciidots 语言力求看起来像艺术……

以下是几个 Asciidots 示例程序,是挺艺术的……

▎16. GolfScript

这门语言旨在实现简单易写(但我没看懂),对于复杂的堆栈操作很有用。

▎15. JSFuck

这门语言有点厉害了,是一种深奥的 JavaScript 编程风格(误。

代码使用的字符集只有六个。它是一种弱类型编程语言,允许评估任何类型的表达式。而且由于它是 JavaScript 的一个子集,因此可以在 JavaScript 的引擎上运行。

下面列出了最短 JSFuck 扩展的字符:

Character	JSFuck
+	(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]])+[])[!+[]+!+[]]
.	(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]
0	+[]
1	+!![] or +!+[]
2	!![]+!![] or !+[]+!+[]
3	!![]+!![]+!![] or !+[]+!+[]+!+[]
4	!![]+!![]+!![]+!![] or !+[]+!+[]+!+[]+!+[]
5	!![]+!![]+!![]+!![]+!![] or !+[]+!+[]+!+[]+!+[]+!+[]
6	!![]+!![]+!![]+!![]+!![]+!![] or !+[]+!+[]+!+[]+!+[]+!+[]+!+[]
7	!![]+!![]+!![]+!![]+!![]+!![]+!![] or !+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]
8	!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![] or !+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]
9	!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![] or !+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]
a	(![]+[])[+!+[]]
d	([][[]]+[])[!+[]+!+[]]
e	(!![]+[])[!+[]+!+[]+!+[]]
f	(![]+[])[+[]]
i	([![]]+[][[]])[+!+[]+[+[]]]
I	(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+(+!+[])+(+[])+(+[])+(+[]))+[])[+[]]
l	(![]+[])[!+[]+!+[]]
N	(+[![]]+[])[+[]]
n	([][[]]+[])[+!+[]]
r	(!+[]+[])[+!+[]]
s	(![]+[])[!+[]+!+[]+!+[]]
t	(!!+[]+[])[+[]]
u	([][[]]+[])[+[]]
y	(+[![]]+[+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+(+!+[])+(+[])+(+[])+(+[]))])[+!+[]+[+[]]]

▎14. Velato

Velato 使用 MIDI 文件作为源代码,音乐的模式决定程序命令。

以下是「Hello World」的 Velato 语言版本:

▎13. Grass

Grass 是一种函数式编程语言,只使用字符「W」「w」和「v」。因此,Grass 中的程序被认为看起来像「草」的 ASCII 艺术。

以下是一个在 Grass 中打印「W」的程序:

wWWwwww

▎12. l33t

在 l33t 的官网上,它被描述成「邪恶的编程语言」。

l33t 设计之初就尽可能地让人感到困惑,它可以自我修改代码。用该语言编写的代码可以用于编写恶意软件。

以下是「Hello World」的 l33t 语言版本:

// "Hello World" by Stephen McGreal.
// Note that the views expressed in this source code do not necessarily coincide 
with those of the author :o)
Gr34t l33tN3$$?
M3h...
iT 41n't s0 7rIckY.
l33t sP33k is U8er keWl 4nD eA5y wehn u 7hink 1t tHr0uGh.
1f u w4nn4be UB3R-l33t u d3f1n1t3lY w4nt in 0n a b4d4sS h4xX0r1ng s1tE!!! ;p
w4r3Z c0ll3cT10n2 r 7eh l3Et3r!
Qu4k3 cL4nS r 7eh bE5t tH1ng 1n teh 3nTIr3 w0rlD!!!
g4m3s wh3r3 u g3t to 5h00t ppl r 70tAl1_y w1cK1d!!
I'M teh fr4GM4stEr aN I'lL t0t41_1Ly wIpE teh phr34k1ng fL00r ***j3d1 5tYlE*** wItH 
y0uR h1dE!!!! L0L0L0L!
t3lEphR4gG1nG l4m3rs wit mY m8tes r34lLy k1kK$ A$$
l33t hAxX0r$ CrE4t3 u8er- k3wL 5tUff lIkE n34t pR0gR4mm1nG lAnguidGe$...
s0m3tIm3$ teh l4nGu4gES l00k jUst l1k3 rE41_ 0neS 7o mAkE ppl Th1nk th3y'r3 ju$t 
n0rMal lEE7 5pEEk but th3y're 5ecRetLy c0dE!!!!
n080DY unDer5tAnD$ l33t SpEaK 4p4rT fr0m j3d1!!!!!
50mE kId 0n A me$$4gEb04rD m1ghT 8E a r0xX0r1nG hAxX0r wH0 w4nT2 t0
bR34k 5tuFf, 0r mAyb3 ju5t sh0w 7eh wAy5 l33t ppl cAn 8E m0re lIkE
y0d4!!! hE i5 teh u8ER!!!!
1t m1ght 8E 5omE v1rus 0r a Pl4ySt4tI0n ch34t c0dE.
1t 3v3n MiTe jUs7 s4y "H3LL0 W0RLD!!!" u ju5t cAn'T gu3s5.
tH3r3's n3v3r anY p0iNt l00KiNg sC3pT1c4l c0s th4t, be1_1Ev3 iT 0r n0t, 1s whAt 
th1s 1s!!!!!
5uxX0r5!!!L0L0L0L0L!!!!!!!

▎11. Chef

一种面向堆栈的编程语言,旨在使程序看起来像烹饪食谱……

以下是「Hello World」的 Chef 语言版本:

Hello World Souffle.
This recipe prints the immortal words "Hello world!",
in a basically brute force way.
It also makes a lot of food for one person.
Ingredients.
72 g haricot beans
101 eggs
108 g lard
111 cups oil
32 zucchinis
119 ml water
114 g red salmon
100 g dijon mustard
33 potatoes
Method.
Put potatoes into the mixing bowl.
Put dijon mustard into the mixing bowl.
Put lard into the mixing bowl.
Put red salmon into the mixing bowl.
Put oil into the mixing bowl. Put water into the mixing bowl.
Put zucchinis into the mixing bowl. Put oil into the mixing bowl.
Put lard into the mixing bowl. Put lard into the mixing bowl.
Put eggs into the mixing bowl. Put haricot beans into the mixing bowl.
Liquefy contents of the mixing bowl.
Pour contents of the mixing bowl into the baking dish.
Serves 1.

▎10. Whenever

没有哪个程序员不喜欢这么一种语言,当你给出计算机一个指令时,计算机就会根据你的要求去执行。但是 Whenever 似乎并不是这样的,它更像是你的宠物猫,它的代码并不是顺序执行的。它们更像是一种「待办事项」清单,它的设计原则是:

  • 代码总会被执行,但执行顺序和指定顺序无关
  • 不需要变量
  • 更不需要数据结构

好奇这种语言究竟有什么用?

▎9. Brainfuck

以极简主义闻名的编程语言,它可以通过一个非常小的编译器实现。该语言只使用八个命令和一个指令指针,每个指令由单个字符组成,是最小的图灵机实现。

以下是「Hello World」的 Brainfuck 语言版本:

++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++ ..+++.>++.
<<+++++++++++++++.>.+++.------.--------.>+.

▎8. LOLCODE

LOLCODE 是用 lolcats 语言设计的,也被称为 lolspeak。

「HAI」用于介绍程序,「KTHXBYE」用于终止。

该语言由 Lancaster University 计算系研究员 Adam Lindsay 于 2007 年创建。

以下是「Hello World」的 LOLCODE 语言版本:

HAI
CAN HAS STDIO?
VISIBLE "Hello World!"
KTHXBYE

▎7. Shakespeare

整个世界是一个程序,所有的男男女女不过是变数。

莎士比亚(Shakespeare)正如其名,是以伟大剧作家莎士比亚的作品为基础的编程语言。在莎士比亚语言中,每个程序都有一个标题、幕、场景和角色,用来组合成一段源代码。

以下是「Hello World」的 Shakespeare 语言版本:

The Infamous Hello World Program.

Romeo, a young man with a remarkable patience.
Juliet, a likewise young woman of remarkable grace.
Ophelia, a remarkable woman much in dispute with Hamlet.
Hamlet, the flatterer of Andersen Insulting A/S.


                    Act I: Hamlet's insults and flattery.

                    Scene I: The insulting of Romeo.

[Enter Hamlet and Romeo]

Hamlet:
 You lying stupid fatherless big smelly half-witted coward!
 You are as stupid as the difference between a handsome rich brave
 hero and thyself! Speak your mind!

 You are as brave as the sum of your fat little stuffed misused dusty
 old rotten codpiece and a beautiful fair warm peaceful sunny summer's
 day. You are as healthy as the difference between the sum of the
 sweetest reddest rose and my father and yourself! Speak your mind!

 You are as cowardly as the sum of yourself and the difference
 between a big mighty proud kingdom and a horse. Speak your mind.

 Speak your mind!

[Exit Romeo]

                    Scene II: The praising of Juliet.

[Enter Juliet]

Hamlet:
 Thou art as sweet as the sum of the sum of Romeo and his horse and his
 black cat! Speak thy mind!

[Exit Juliet]

                    Scene III: The praising of Ophelia.

[Enter Ophelia]

Hamlet:
 Thou art as lovely as the product of a large rural town and my amazing
 bottomless embroidered purse. Speak thy mind!

 Thou art as loving as the product of the bluest clearest sweetest sky
 and the sum of a squirrel and a white horse. Thou art as beautiful as
 the difference between Juliet and thyself. Speak thy mind!

[Exeunt Ophelia and Hamlet]


                    Act II: Behind Hamlet's back.

                    Scene I: Romeo and Juliet's conversation.

[Enter Romeo and Juliet]

Romeo:
 Speak your mind. You are as worried as the sum of yourself and the
 difference between my small smooth hamster and my nose. Speak your
 mind!

Juliet:
 Speak YOUR mind! You are as bad as Hamlet! You are as small as the
 difference between the square of the difference between my little pony
 and your big hairy hound and the cube of your sorry little
 codpiece. Speak your mind!

[Exit Romeo]

                    Scene II: Juliet and Ophelia's conversation.

[Enter Ophelia]

Juliet:
 Thou art as good as the quotient between Romeo and the sum of a small
 furry animal and a leech. Speak your mind!

Ophelia:
 Thou art as disgusting as the quotient between Romeo and twice the
 difference between a mistletoe and an oozing infected blister! Speak
 your mind!

[Exeunt]

▎6. Befunge

Befunge 创建者 Chris Pressey 的目标很简单—— 设计一种编程语言,尽可能难以编译。

Befunge通过其两个主要特征来实现这一点:

  • 自我修改的代码:指令可以在游戏区中写入新的指令
  • 多维代码:相同的指令可以在四种不同的上下文中执行(从左到右,从右到左,向上或向下)

程序安排在二维网格上,「箭头」指令指示控制流向左,向右,向上或向下。

该语言最早于 1993 年推出,已经有人成功地为它创建了编译器。

▎5. Piet

Piet 是一种将编程转换成抽象几何绘画的语言。程序由 20 种不同的颜色组成,然后由编译器根据十六进制值读取运行。

这是一段「Hello World」:

这也是一段「Hello World」

即使是在 Piet 语言里,程序员的能力也是有高低之分的~

▎4. Whitespace

Whitespace 程序是用……空格键(whitespace)编写的。 Whitespace 官网上有对该语言使用方式的详细描述。

大多数现代编程语言并不考虑空格字符(空格,制表符以及换行符)。Whitespace 就是一种想要纠正这种不公平的编程语言。在 Whitespace 语言里,任何非空白字符都是被忽略的,只能使用空格、制表符和换行符来编写程序。

由于所有非空白字符都被忽略,所以可以很容易地将Whitespace程序嵌入到用C,C ++,Java等其他语言编写的程序中。

以下是「Hello World」的示例(非白色的颜色编码用于辅助理解):

▎3. Ook!

这是一门真正的程序猿语言!它主要是为灵长类动物,特别是猩猩,设计的语言。

在 Ook!语言里,仅由三个语法元素组成:

  • Ook.
  • Ook?
  • Ook!

它们被组合成 2 个组,总共 2^3 = 8 个可用的元素,类似于 Brainfuck。

一段「Hello World」了解一下:

Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.

▎2. Malbolge

BenOlmstead 在 1998 年引进公共领域的深奥程序语言,名称来源于「the eighth circle of hell in Dante's Inferno」,地狱的意思。

Malbolge 结合了机器语言,以及由当今存在的一些最复杂扭曲的编程思想所创建的东西。第一个程序甚至不是由人类编写的,而是由 Andrew Cooke 设计并在 Lisp 中实现的波束搜索算法生成。

算了还是看看它怎么写「Hello World」:

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

看懂了吗?

▎1. Chicken

Chicken 不仅是语言的名字,也是该语言允许的唯一关键字。

关键字重复的次数和换行决定执行的具体操作。

Chicken 的「Hello World」:

chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken

chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken

chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken
chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken

chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken

chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken

chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken


可能这些程序员工作真的不饱和吧……


原文链接:

Top 20 Strangest Programming Languages

分类收藏:

产品 | 设计 | 技术 | HackLife | Photography

推荐阅读:
Fira Code | 一个程序员专用字体zhuanlan.zhihu.com图标

编辑于 2018-11-06

文章被以下专栏收录