First classical Chinese programming language
- Who
- Lingdong Huang
- What
- First
- Where
- United States (Pittsburgh)
- When
- December 2020
The first classical Chinese programming language is Wenyan-lang, a Turing-complete general purpose language developed in Dec 2019 by Lingdong Huang (CHN) while he was a student at Carnegie Mellon University in Pittsburgh, Pennsylvania, USA.
The syntax of Wenyang-lang is based on classical Chinese, and all programs in Wenyang-lang are both machine-readable code and grammatically coherent classical Chinese. The language uses traditional Chinese characters, a very limited number of symbols (「, 」and 。) and, like classical Chinese, does not use spaces between words or characters. This last feature made creating a compiler a challenge, as running the code requires the computer to pick out the instructions (specific words that form the building blocks of a program) from other text strings (variable names, array contents output text, etc.).
Lingdong Huang boasts that his new language is "guaranteed to be readable by ancient Chinese people" and has created an add-on to his compiler that renders the code in the style of a traditional Chinese manuscript. What began as a side project (that Lingdong started shortly before his final exams at college) has now become a collaborative project involving 50 contributors from around the world.
Programs written in Wenyang-lang include standard demos such as a "Hello World" script and a Mandelbrot set generator, as well as implementations of ancient Chinese ideas such as the method for calculating pi developed by mathematician Liu Hui in the 3rd century CE and the divination algorithm described in the I-Ching around 3,000 years ago.
The beginning of a quicksort program that in javascript would look like this:
let qsort = (a)=>((a.length <= 1)? a:
Would be rendered as follows in Wenyang-lang:
I have a way. Name it "quicksort".
To utilize it, one must obtain an array, called "A". And thus describes the way:
If the length of "A" is not greater than one:
Thus we get "A".