20 種最奇怪的程式語言

Aceyclee發表於2018-05-21

第一次遇到這些語言時,我下意識覺得有些程式設計師可能工作不飽和(微笑)。其實這些語言中有一些是為了特定目的而建立的,另一些則是在於挑戰和娛樂。總之,非常羨慕這些又聰明又有時間的人了!

不多說,看看這 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 示例程式,是挺藝術的……

20 種最奇怪的程式語言

▎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 語言版本:

20 種最奇怪的程式語言

▎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 年推出,已經有人成功地為它建立了編譯器。

Befunge.jpg

▎5. Piet

Piet 是一種將程式設計轉換成抽象幾何繪畫的語言。程式由 20 種不同的顏色組成,然後由編譯器根據十六進位制值讀取執行。

這是一段「Hello World」:

20 種最奇怪的程式語言

這也是一段「Hello World」

20 種最奇怪的程式語言

即使是在 Piet 語言裡,程式設計師的能力也是有高低之分的~

▎4. Whitespace

Whitespace 程式是用……空格鍵(whitespace)編寫的。 Whitespace 官網上有對該語言使用方式的詳細描述。

大多數現代程式語言並不考慮空格字元(空格,製表符以及換行符)。Whitespace 就是一種想要糾正這種不公平的程式語言。在 Whitespace 語言裡,任何非空白字元都是被忽略的,只能使用空格、製表符和換行符來編寫程式。

由於所有非空白字元都被忽略,所以可以很容易地將Whitespace程式嵌入到用C,C ++,Java等其他語言編寫的程式中。

以下是「Hello World」的示例(非白色的顏色編碼用於輔助理解):

20 種最奇怪的程式語言

▎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

我的知乎:@Aceyclee | 我的微博:@Aceyclee

相關文章