PROGRAMMING IN CLASSICAL CHINESE

Lingdong Huang et al., An Introduction to Programming in Wenyan, 2020 [CC BY-NC 4.0].

RELIC

This yellowed code was designed to look as if it came from an ancient book. In reality, the work is less than a decade old – and likely exists only in digital form. It is the so-called “relic” edition of the Wenyan programming language manual.

ABOUT CODE

Dominated by English syntax, now the global norm, contemporary programming tends toward a uniformity of computational thought. Some experimental languages remind us that coding can also be a cultural and linguistic act.

Created by Lingdong Huang in early 2020, Wenyan cleverly borrows grammatical structures from Classical Chinese (wenyan) – the language of many Chinese classics, including The Nine Chapters on the Mathematical Art. A Wenyan program consists of stylized yet grammatically correct wenyan sentences.

The code’s eleven columns are read top to bottom, right to left. Programming best practices here echo the spatial layout of traditional Chinese mathematical texts: indentation and syntax coloring aid overall readability. Variable names appear in blue ink, control structures in red, instructions in black, and numbers in yellow.

The algorithm depicted computes Pascal’s triangle. The first ten columns define the algorithm; the far-left column specifies its computation up to the seventh row. The first two output lines appear at the page’s left edge: “1” and “1 1.” Though the algorithm itself holds no surprises, there is irony in presenting Pascal’s triangle in Classical Chinese – an object described in the 13th century by Yang Hui, yet named after a 17th-century French mathematician.

Wenyan illustrates the creative freedom that history and linguistics can bring to programming – at a time when the dominance of Python or C risks erasing such diversity.

BIOGRAPHY

Baptiste Mélès, a graduate of the École normale supérieure in Paris, agrégé and PhD in philosophy, and ambassador of Software Heritage, is a researcher at the CNRS. His work in the philosophy of computing draws on the direct study of source code and the linguistic dimensions of programming. Since 2015, he has co-organized the Codes Sources seminar in Paris.

#Chinese

#Programming Language