February 4, 2020

The introduction of the world's first classical Chinese programming language

The programming language called " wenyan-lang " was created by Lingdong Huang , a Chinese student at Carnegie Mellon University (CMU) last year.Last month, Huang used the last week before graduation to complete the core functions of this language, and the world ’s first classical language was officially born.
之世,結繩而足治,屈指而足算。是時豈料百代之後,計算機械之巧,精於公輸木鳶,善於武侯流馬;程式語言之多,繁若《天官》之星宿,奇勝《山經》之走獸。,或以速稱。,各爭文采。方知鬼之所以夜哭,天之所以雨粟。然以文言編程者 ,似所未有。此誠非文脈之所以傳,文心之所以保。嗟予小子,遂有斯志。然則數寸之烏絲猶覆於頭,萬卷之素書未破於手;一身長羁于远邦,兩耳久旷于雅言。然夫文章者吾之所宿好,程式者偶承時人之謬譽。故希孟不慚年少,莊生不望無涯。乃作斯言。誠未能嘔瀝長吉心血,亦庶幾免於義山流沫。既成之後,復學干將鑄劍而自飼,越王嚐糞而當先。自謂偶追《十書》之筆意,但恨少八家之淋漓。此子山所謂士衡抚掌而甘心,平子見陋而固宜。然則雖實覆甕之質,尚存斧正之望;雖乏呂相之金,易字之渴蓋同。此亦開源之大義,吾輩之所以勉勵也。一笑。
This is not the "Please read and recite the full text" series, but a preface to a code project on GitHub. Why use classical Chinese? Because this is a project programmed in classical Chinese.
Although the classical programming language was only one month old, it has attracted many people to write programs with it. According to Huang introduced , has several programs with ten classical programming language, and more than half of which were written by other people. Many of these programs are based on ancient Chinese mathematical works, such as the calculation method of the pi rate of mathematicians in the Three Kingdoms era, and even the fortune-telling algorithms of the Book of Changes.
So how exactly is programming in classical Chinese? This is not so simple to convert English characters into classical Chinese, but to use natural language processing (NLP) technology to compile classical programming languages ​​into programming languages ​​such as JavaScript, Python, and Ruby.
For example, the classic code "Helloworld" in the programming world, if written in a classical programming language:
If you translate this code into JavaScript, it looks like this:

var n = 3;
for (var i = 0; i < n; i++) {

Why Huang created a programming language that uses classical Chinese? In fact, the preface on the GitHub project has already stated the answer. The main point of this preface is that today's computers are very sophisticated and there are many programming languages, but no one has tried to use them in the past. Writing in classical Chinese, he believes that this is also a way to inherit the context and protect the history.

In addition, Huang also developed an "Ancient Chinese Code Generator", which can convert the boring classical Chinese code into a page of an ancient book, which has a more classical atmosphere in the visual sense.
Huang received a degree in computer science and art from Carnegie Mellon University (CMU) in December last year. In addition to his classical Chinese programming language, he also used a computer program to generate a Chinese landscape painting . He also participated in the development of the first Kunqu video synthesized by artificial intelligence .

Huang is currently writing an introductory guide to classical programming in classical Chinese. The goal is to allow more people with no programming experience to use classical programming languages, which is currently 40% complete.
In an interview with the media , Huang stated that he was fascinated by classical Chinese. He had read a lot of classical Chinese books before college. Now he is reading Huainanzi, and this book has a sentence:
This sentence tells the story of Cangjie making words, weeping ghosts and gods. Words are one of the greatest inventions in the world. History has been recorded since then, and knowledge can be transmitted. In this age of the Internet, lines of code make up the entire vast digital world. Programming in classical Chinese did indeed find a new way for the inheritance of ancient characters.

1 comment:

  1. Thanks for sharing the best information and suggestions, I love your content, and they are very nice and very useful to us. If you are looking for the best Secondary Chinese,then Chinese Distinction.I appreciate the work you have put into this.