跳到正文

科技·工程

媲美各大编程语言的万分之一

Milthm约 4 分钟
原文

这是 2026年2月2日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2026年2月1日
收录
2026年2月2日
更新
2026年11月22日
篇幅
约 4 分钟

版本

  1. v3当前
  2. v2
  3. v1

你以为这世上只有语言C++、Java、Python等等这些语言吗

晦涩编程语言(Esoteric Programming Language,Esolang)大赏

(能让人笑出来的语言不失为一个好语言)

1. Shakespeare(SPL)

对,就是莎士比亚的剧本

功能

概念语句
变量角色名
分段Act I: 、Scene I:
引入变量[Enter ...]
引出变量[Exit ...]
赋值You are ...、You are as ... as ...
加法sum of A and B
减法difference between A and B
乘法product of A and B
除法quotient between A and B
平方square of A
立方cube of A
输入数字Listen to your heart.
输入字符Open your mind.
输出数字Speak your mind.
输出字符Open your heart.
大于Am I/Is ... better than ...?
小于Am I/Is ... worse than ...?
等于Am I/Is ... equal than ...?
条件跳转If so, let us proceed to scene III.
结束[Exeunt]
注释其他样式的语句

结构

标题

对代码没什么影响,相当于给你的程序命名,结尾有一个.,比如say hello world.,这个不必要

人物介绍

把你代码中用到的变量介绍一遍,变量名随意但首字母必须大写,如Romeo、Shabby等

具体格式就是Name, something.,something 写什么都行

幕

因为是剧本所以必须得有幕,这个可以用来标注代码每一段的用途,格式是 Act I: something,注意数字用罗马数字

景

剧本嘛,景也是要有的,格式是 Scene I: something

对话

SPL的语句都是以对话形式执行的,对话前必须引入角色,每句话要有一个对应的角色作为说话者,此时语句中的 You 指代这个场景中的另一个人(在场景中只有两个人的时候),I 就是说话者

比如这个:

代码
[Enter Romeo]
[Enter Shabby]
Shabby:
    You are nothing. Speak your mind.

就是输出 Romeo 存储的数字

示例(A + B problem)

代码
The Addition of Two Integers.

Romeo, a young man.
Shabby, a value.
Awsl, dudsifidasoicodsibjw.

                    Act I: wowowowowow.
                    Scene I: Input.

[Enter Romeo and Awsl]

Awsl:
You are nothing! Listen to your mind!

[Exit Romeo]
[Enter Shabby]

Awsl:
You are nothing! Listen to your heart!

                    Scene II: Plus.

[Exit Shabby]
[Enter Romeo]

Awsl:
You are the sum of yourself and Shabby!

                    Scene III: Output.

Awsl:
Speak thy mind!

[Exeunt]

什么,你说这还是太好懂了?

2. Befunge