The Wenyan-lang Hello World program reads like this:
Even those of us who don't understand the characters can likely recognize it as a form of Natural Language Programming—a programming language whose code mimics prose—in its wordiness and its structure as sentences. In fact, Wenyan is built on its namesake, Classical Chinese (or Wényán), the written form of Chinese used from the 5th century BCE to the early 20th century. Because Wenyan-lang's inventive feature occurs in the nuance and humor of its multicoding between Classical Chinese and code, as a non-reader, I am exploring this language through the insights of others. Yidi Tsao, a Berlin-based artist, curator and writer, explains that the text the Hello World actually prints (you can see it between the quotes 「「 and 」」) translates not to "Hello, World!" but closer to "Greetings to Heaven and Earth."
The humor and poetry in its engagement with Wényán become more clear in longer examples. In the 99 Bottles program below (translated and notated by Tsao), beer is replaced with the more era-appropriate wine:
I have a word, called “spring feast”.
There are nine numbers. I call it "wine number". (note: 九 nine and 酒 wine are homophones in Chinese.)
It is always like that. It only stops when "wine number" is zero.
I have three words. one is "with you". The other is "wine number".
It says, "glasses of wine. All the fun of the feast. A glass of green wine then a song."
Minus one from "wine number". Previous "wine number", now is this.
I have a word. It says "thousands of glasses of wine. my stomach is done."
The phrases came from a poem called "to Wang Han Yang" by Li Bai, who is famous for his drinking habit, also the greatest poet in Chinese history. :D
99 Bottles program in Wenyan-lang interpreter
Lingdong looked to Chinese art for inspiration on the visual presentation:
I’ve taught myself traditional painting a few years ago, and have been reading Chinese classics since very young. I enjoy the minimalistic aesthetics of Song Dynasty the most. My favorite Chinese artist is probably Ni Zan, known for his extremely bleak yet serene landscape paintings in washed out ink.
Other projects of Lingdong's reflect this confluence of art and programming. Before creating Wenyan, he designed the Recursive Radical Packing Language, a clever system for describing arbitrary Chinese characters on a grid (somewhat reminiscent of the Letter Spirit project), and then combining grids together to build more complex composite forms.
Wenyan-lang was quickly recognized by a larger community of programmers and contributors toward a growing Wenyan ecosystem. Wenyan-lang now transpiles not only to JS, but Python, Ruby, and C++. Lingdong, who is described by one professor as shy, was at first a bit overwhelmed by the response:
Originally it was purely for fun, but apparently from the feature requests it seems that we Chinese programmers tend to be very practical people. I think being artistic and practical is not mutually exclusive events for wenyan-lang. Despite being needlessly archaic, the syntax itself is quite expressive actually, as it’s modeled on the Classical Chinese language, which is very expressive.
Discussions on its GitHub issue pages exploded early not only about programmatic fixes but what would best fit the spirit of Classical Chinese. Most of this discussion is in Chinese, and some in Classical Chinese. The project now has more stars on Github than major projects like Microsoft's Roslyn compiler. The fact that the discussions are not in English may explain why a project with such a huge following has not received more press here.
Lingdong and others wrote a manual for Wenyan in Classical Chinese, in physical book form and online as an enormous side-scrolling volume. It begins with a philosophical statement of purpose according to Tsao’s translation:
What is programming? It’s to control machines. What is a machine? It’s to replace human labour. Because it has a wide range of capacities and its speed is fast.
Only it is not so intelligent. so we need wise people to programme it. When you write lines of codes, it’s like military commands. It’s like prescriptions.
We call it algorithms.
Wenyan-lang is part of a movement of programming languages that challenge English as the default (usually only) source for keywords. Ramsey Nasser's Arabic programming language 'alb is perhaps the best-known example. However, the lexicon of 'alb (like most programming languages and LISPs in particular) is modest compared to Wenyan-lang's. Just as programmers in Asia who might have no other use for the Roman character-set need to memorize words like "function" and "return" to write in C#, English-speakers could take the time to memorize the commands of 'alb, adjust to its right-to-left script, and write code just fine; it doesn't take a functioning knowledge of Arabic, which is a far larger commitment.
This can be contrasted with Jon Corbett's Cree#, which adopts not only the Canadian Syllabic alphabet for its keywords, but also the Cree traditions of storytelling to structure programs. To use Cree#, you must not only adjust to a different set of keywords, but to understand how those stories are transmitted, including steps to placate the mischievous Raven responsible for code execution. Corbett's work and other languages challenging the cultural dominance of English is explored in a chapter ("FLOW-MATIC") in Mark Marino's recent book Critical Code Studies (and Cree# will be discussed at length in an upcoming esoteric.codes interview with Corbett).
David Branner, a Computational Lexicographer whose PhD focused on Chinese dialectology, puts Wenyan somewhere between these two, with a lexical toolbox much larger than that of 'alb but without the unusual language features of Cree#.
The multi-character expressions of Wenyan-Lang are indivisible primitives — they are whole units, and parsed so as to correspond to specific elements of the grammar. In contrast, most multi-character expressions in Wényán can be analyzed compositionally, as sequences of single-character primitives.... For instance, the string 所餘幾何 literally "that which is extra, by how much" — that is, "how much remains" — represents an operator for modulus remainders. Its second character, 餘 "to be extra", also appears in another primitive in the grammar, but there is no relationship between the two primitives — internally, they're independent of one another. You could replace the characters with unique emoji or other symbols, one to one, and it would work just as well (except that it would no longer be readable to people who know some Wényán).
In other words, despite Wenyan-lang's relative wordiness, it functions very much like other programming languages, with keywords that don't change meaning contextually. He adds:
Wenyan-Lang project is a tour de force. It's a delight to read, and I'm excited to see a significant range of libraries being developed for it.
Since creating Wenyan-lang, Lingdong has continued his work in language design, recently creating Wax, a language intended to be a "common subset" of most major imperative programming languages. Its LISP-like syntax (although Wax is procedural) strips away much of the complexity and eccentricities of these languages, allowing for a quick way to mock up an idea which can then be transpiled into C++, Python, TypeScript, or a host of other languages. It is like a Toki Pona of programming, embracing simplicity and clarity.
However, the continuing interest in and expansion of Wenyan has also kept him busy. Asked about the future of this growing language, Lingdong looks to the adoption of his esolang in mainstream programming:
I think the real art would be that one day it is actually used for production code. Then we'll be living in art :)