# INTERCAL

**INTERCAL**，全称 *Compiler Language With No Pronounceable Acronym*（没有可发音缩写的编译器语言），是一门戏仿性质的编程语言，由唐纳德·R·伍兹（Donald R. Woods）与詹姆斯·M·里昂（James M. Lyon）于1972年5月26日上午在普林斯顿大学（Princeton University）设计<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。其公开宣称的雄心是：打造一门与当时任何主流语言——如 FORTRAN、BASIC、COBOL、ALGOL、APL、LISP 和 PL/I——毫无共同之处的编译器语言；它只保留变量、数组和输入输出等基本元素，摒弃一切常规运算<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。它被普遍视为最早的[深奥编程语言](https://www.edgepedia.org/zh/esoteric-programming-language)（esoteric programming language），后来的深奥语言也大多继承了它对常规语言设计那种戏谑、讽刺的姿态<sup>[2](https://arxiv.org/abs/2505.15327)</sup>。

| 关键事实 | 详情 |
|---|---|
| 全称 | 没有可发音缩写的编译器语言<sup>[3](https://hopl.info/showlanguage2.prx?exp=585)</sup> |
| 设计时间 | 1972年5月26日上午，由唐纳德·R·伍兹与詹姆斯·M·里昂在普林斯顿大学设计<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup> |
| 首个实现 | 用 SPITBOL 为 IBM/360 编写的 INTERCAL-72 编译器，使用 EBCDIC 字符集<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup><sup> • </sup><sup>[3](https://hopl.info/showlanguage2.prx?exp=585)</sup> |
| 礼貌规则 | 带有 PLEASE 的语句不足五分之一，程序会因不够礼貌而被拒绝；超过三分之一，则因过度礼貌而被拒绝<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup> |
| 标志性语句 | COME FROM，在 C-INTERCAL 中加入，源自 R. L. 克拉克1984年发表于《ACM通讯》的愚人节论文<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup> |
| 运算符 | Mingle（普林斯顿语法用 ¢，雅达利语法用 $）与选择运算；二元运算符写作 & 表示 AND，V 表示 OR，用退格叠印的“书虫”或 ? 表示异或<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup> |
| 现代实现 | C-INTERCAL（埃里克·S·雷蒙德，1991年）、CLC-INTERCAL、J-INTERCAL、基于 Rust 的 Rick，以及 INTERCAL-64<sup>[3](https://hopl.info/showlanguage2.prx?exp=585)</sup><sup> • </sup><sup>[5](https://github.com/birkenfeld/rick)</sup><sup> • </sup><sup>[6](https://github.com/PLEASE-ABSTAIN/INTERCAL64)</sup> |

## 起源与目的

用一份早期记述的话说，这门语言是1972年5月26日上午在普林斯顿“与其说是设计出来的，不如说是犯下的”<sup>[7](https://www.catb.org/~esr/intercal/stross.html)</sup>。其手册本身解释了目标：构建一门与作者所知的任何主流语言都不共享任何东西的编译器语言。大体而言它忠于这一目标，只保留变量、数组和输入输出的能力，回避一切常规运算<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。后来的一篇综述称其为“编程语言设计史上持续时间最长、最曲折的笑话”，并指出：尽管这门语言最初只有一个极简的编译器和几乎可以忽略的源码量，它还是吸引了一批忠实的拥趸，包括[埃里克·S·雷蒙德](https://www.edgepedia.org/zh/eric-s-raymond)与唐纳德·克努特（Donald Knuth），他们帮助它传播开来<sup>[2](https://arxiv.org/abs/2505.15327)</sup>。

普林斯顿最初的编译器用 SPITBOL（SNOBOL 的一个变体）编写，分两个阶段编译：先将 INTERCAL 源码转换为 SPITBOL 源码，再行编译<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。该编译器从未广泛流传，原始源码失落数十年，直到后来被找回并发表<sup>[8](https://www.catb.org/esr/intercal/)</sup>。

## 语言特性

一个 INTERCAL 程序是一系列语句，每条语句由可选的行标号、语句标识符、可选的执行概率、语句本身，以及可选的 ONCE 或 AGAIN 组成<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。每条语句都以一个标识符开头：DO、PLEASE 或 PLEASE DO<sup>[9](https://podscripts.co/podcasts/future-of-coding/intercal-by-donald-woods-james-lyon)</sup>。

**礼貌。** INTERCAL-72 有一项原始手册未记载的特性：必需的礼貌程度。若程序中含 PLEASE 限定词的语句不足五分之一，程序会因不够礼貌而被拒绝；若超过三分之一，则因过度礼貌而被拒绝<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。C-INTERCAL 实现了这一检查，随发行版附带的 intercal.el 编辑器模式会以四分之一的概率随机把“do ”扩展为“PLEASE DO”，帮程序员应付这一关<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。

**运算符。** INTERCAL 的二元运算包括一些非常规操作，例如按位交错两个值，这使得普通算术变得复杂而曲折<sup>[2](https://arxiv.org/abs/2505.15327)</sup>。Mingle 运算符在普林斯顿原始语法中写作美分符号，称为“零钱”；在雅达利语法中写作“大钱”字符 $；异或运算符在普林斯顿 INTERCAL-72 中写作“书虫”，即一个 V 用退格叠印一个连字符，这种组合在某些系统上会出问题——这大概正是当初的本意<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。AND 与 OR 分别写作 & 和字母 V<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。

**控制流。** 语句通常按顺序执行，但许多情况可以改变这一点，包括 NEXT 语句——所有已知的 INTERCAL 编译器都将其返回地址栈限制在80个位置，据说这一限制是为了防止 NEXT 栈泄漏<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。语句还可以带一个写作 %n 的执行概率，即该语句执行的概率百分比，并可用 NOT 或 N'T 取反<sup>[7](https://www.catb.org/~esr/intercal/stross.html)</sup>。

**COME FROM。** INTERCAL 最著名的增补是 COME FROM 语句，它让控制流从程序中的别处到达某个带标号的位置，从而免去 GOTO，同时保留了自修改控制流的乐趣<sup>[7](https://www.catb.org/~esr/intercal/stross.html)</sup>。计算文献中对 COME FROM 最早的可考描述是 R. L. 克拉克的《对无 GOTO 编程的语言学贡献》，《ACM通讯》第27卷（1984年），第349–350页，属于著名的愚人节专刊；由于语言设计者们随后蜂拥采用它的盛况并不存在，于是决定 COME FROM 应归入 C-INTERCAL<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。

**数字格式。** 为契合这门语言唱反调的性格，C-INTERCAL 默认以[罗马数字](https://www.edgepedia.org/zh/roman-numerals)输出数字；一个默认关闭的运行时“懦夫模式”选项，可以让用户在先被一段关于自己何等懦弱的羞辱性消息洗礼之后，选择常规记数法<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。

## 实现与语法史

用这门语言自己手册的话说，它的历史饱受多种语法与字符集之苦<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。普林斯顿编译器使用 EBCDIC；一个未完成的雅达利实现曾在1982年为原始手册所增补的内容中预先描述过，它改用 ASCII，并以 $ 取代美分符号，因为 ASCII 没有“零钱”符号<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup><sup> • </sup><sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。存留至今的有两个语法家族：普林斯顿原始语法，被视为官方语法，也是 CLC-INTERCAL 的默认语法；以及雅达利语法，为 C-INTERCAL 和 J-INTERCAL 所使用，由于依赖纯 ASCII，在 Usenet 上交换程序时最为常见<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。

最初版本问世十八年后，程序员、《新黑客词典》作者埃里克·S·雷蒙德利用一个周末的业余时间，犯下了一个运行于 UNIX 的 INTERCAL 编译器；C-INTERCAL 以 C 作为中间语言，此后由一个国际社区维护和扩展，成员包括路易斯·豪厄尔、史蒂夫·斯韦尔斯、迈克尔·恩斯特和布莱恩·雷特<sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup><sup> • </sup><sup>[7](https://www.catb.org/~esr/intercal/stross.html)</sup>。其后续版本加入了 COME FROM 以及多语言支持，包括巴斯克语、纳瓦特尔语、梵语和他加禄语；0.18及以后的版本还做了古罗马本地化，接受拉丁语关键字作为英语关键字的等价物<sup>[3](https://hopl.info/showlanguage2.prx?exp=585)</sup><sup> • </sup><sup>[1](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)</sup>。CLC-INTERCAL 将普林斯顿语法扩展到现代特性；由马尔科姆·瑞安以修改版 C-INTERCAL 创建的 Threaded INTERCAL 实现了基于 COME FROM 的多线程<sup>[4](https://www.catb.org/~esr/intercal/ick.htm)</sup>。

较新的实现包括 Rick——一个用 Rust 编写、紧密模仿 C-INTERCAL 的解释器兼编译器，实现了基础 INTERCAL-72 语言外加 COME FROM、计算式 COME FROM、TRY AGAIN、计算式 ABSTAIN 和二进制数组 I/O；其解释器将源码解析为它所谓的 AST，即“抽象施虐树”，运行速度比翻译成 Rust 的编译模式慢约10倍<sup>[5](https://github.com/birkenfeld/rick)</sup>。INTERCAL-64 是一个基于 .NET 的编译器，名为 churn，为语言扩展了64位算术、纯 INTERCAL 系统库，以及用于 VS Code 的 DAP 调试器<sup>[6](https://github.com/PLEASE-ABSTAIN/INTERCAL64)</sup>。这门语言已被主流发行版收录：Debian 同时提供 intercal 和 clc-intercal 两个编译器包<sup>[10](https://packages.debian.org/intercal)</sup>，在 macOS 上可用 brew 安装，在 Ubuntu 上可用 apt 安装<sup>[2](https://arxiv.org/abs/2505.15327)</sup>。

## 在编程语言文化中的位置

INTERCAL 被视为深奥语言的典型代表，体现了这一类型的基本原则：语法荒诞，以及对常规语言设计的讽刺<sup>[2](https://arxiv.org/abs/2505.15327)</sup>。深奥语言的研究者将其哲学认定为“技术受虐狂”，因为程序员似乎从痛苦的开发体验中获得快感<sup>[2](https://arxiv.org/abs/2505.15327)</sup>。《软件研究：一部词典》中的一章将它和那些评点 FORTRAN、COBOL 等传统语言特性的戏仿语言归为一类，并与 [Malbolge](https://www.edgepedia.org/zh/malbolge) 形成对照——后者是后来专门设计成难以编程的语言，而不仅仅是不与其他语言共享任何东西<sup>[11](https://sidoli.w.waseda.jp/Mateas_2006_Weird_Languages.pdf)</sup>。

实际用途罕见但并非没有。有记录的 INTERCAL 项目包括数学程序、一个自产生程序（quine），以及一个把这门语言带上万维网的 CGI 脚本<sup>[12](https://stackoverflow.com/questions/33824200/are-there-any-real-world-applications-written-in-intercal)</sup>。2025年的一篇学术文章主张，即便是 INTERCAL 这样的玩笑语言也值得认真研究，因为在其自设的约束内工作，可以提升对编程语言的总体意识，并磨砺对语言设计的思考<sup>[2](https://arxiv.org/abs/2505.15327)</sup>。

## References

1. [Donald R. Woods and James M. Lyon, *The INTERCAL Programming Language Revised Reference Manual* (with C-INTERCAL revisions by Louis Howell and Eric S. Raymond)](https://forstinea.nl/documents/INTERCAL%20revised%20reference%20manual.pdf)
2. [Jeremy Singer and Steve Draper (2025). Let's Take Esoteric Programming Languages Seriously. Onward! '25, ACM.](https://arxiv.org/abs/2505.15327)
3. [INTERCAL (ID:585/int010), Online Historical Encyclopaedia of Programming Languages (HOPL)](https://hopl.info/showlanguage2.prx?exp=585)
4. [C-INTERCAL 0.29 Revamped Instruction Manual](https://www.catb.org/~esr/intercal/ick.htm)
5. [Rick: INTERCAL interpreter/compiler in Rust, GitHub](https://github.com/birkenfeld/rick)
6. [INTERCAL-64: a 64-bit INTERCAL compiler and runtime, GitHub](https://github.com/PLEASE-ABSTAIN/INTERCAL64)
7. [Charles Stross (1992). INTERCAL -- the Language From Hell.](https://www.catb.org/~esr/intercal/stross.html)
8. [The INTERCAL Resources Page](https://www.catb.org/esr/intercal/)
9. [Future of Coding podcast: INTERCAL by Donald Woods & James Lyon, transcript](https://podscripts.co/podcasts/future-of-coding/intercal-by-donald-woods-james-lyon)
10. [Debian package search: intercal](https://packages.debian.org/intercal)
11. [Michael Mateas (2006). Weird Languages. In *Software Studies: A Lexicon*, MIT Press.](https://sidoli.w.waseda.jp/Mateas_2006_Weird_Languages.pdf)
12. [Are there any real world applications written in INTERCAL? Stack Overflow](https://stackoverflow.com/questions/33824200/are-there-any-real-world-applications-written-in-intercal)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Programming languages › Individual programming languages › C-family and imperative languages

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/intercal

English original: https://www.edgepedia.org/intercal
