Ambrose Li

From the weird department: the Wenyan programming language

(updated )

A few days ago I stumbled on the programming language Wenyan, designed by Lingdong Huang, a programmer–artist from CMU.‍[Note 1] Unlike most programming languages in use today, Wenyan does not try to pass off as resembling English: programs written in Wenyan are written completely in Chinese characters.

Wényán, of course, is 文言 (ˌmɐnˌjin), or Classical Chinese.‍[Note 2] Not only are Wenyan programs written in Chinese characters; they are in fact pretty much actual, grammatically correct Classical Chinese.

Here is an example of what a Wenyan program looks like (I kid you not), pulled straight from the example file “factorial.wy”:


施「階乘」於五。書之。[Note 3]
The example program factorial.wy to calculate the factorial of a number

This is what the program means, quite literally:

I have a method‍[Note 4]; call it ‘factorial’.
If [you] want to run this method, [it] must first receive a number, namely A.
Then, running this method means:
	If A equals one,
		[the] result [is] A.
	If not,
		decrease A by one, name it B;
		Apply ‘factorial’ to B, name it C;
		Multiply C by A, name it D;
		[The] result is D.
Such is [the] method called [the] ‘factorial’.

Apply ‘factorial’ to five. Write it [out].
English translation of the example program

If you have a background in computer science, you might notice the English translation look awfully like pseudocode; but the Chinese source text is not pseudocode, it’s actual, executable code.

Many years ago, the Japanese also created a programming language that used Japanese characters, but I don’t know what happened to that language. I also don’t know how closely it resembled actual Japanese, but this one is pretty close.


  1. Lingdong Huang, wenyan-lang: Programming language for the ancient Chinese, https://​github​.com/​wenyan​-lang/​wenyan.
  2. Classical Chinese to Chinese is like Old English is to English. But some consider it to be more like Latin, in terms of its cultural significance; see, for example, Martin Oei, “日本首相菅義偉稱台灣為國代表乜?” [What is the significance that Yoshihide Suga, the prime minister of Japan, called Taiwan a country?], June 9, 2021, https://​www​.youtube​.com/​watch​?​v​=​l​NByy​OVDjbw, 9:18–11:24.
  3. Lingdong Huang, 階乘 [factorial], https://​github​.com/​wenyan​-lang/​wenyan/​blob/​master/​examples/​factorial​.wy.
  4. The noun 術 (ˍsœt) can be translated variously as method, technique, procedure, algorithm, or even magic spell.