wy-lang.org | Wiki | The Book
文言文編程語言。A programming language for the ancient Chinese. Try it online.
夫唐、虞之世,結繩而足治,屈指而足算。是時豈料百代之後,計算機械之巧,精於公輸之木鳶,善於武侯之流馬;程式語言之多,繁若《天官》之星宿,奇勝《山經》之走獸。鼠、蟹、鑽、魚,或以速稱。蛇、象、駱、犀,各爭文采。方知鬼之所以夜哭,天之所以雨粟。然以文言編程者 ,似所未有。此誠非文脈之所以傳,文心之所以保。嗟予小子,遂有斯志。然則數寸之烏絲猶覆於頭,萬卷之素書未破於手;一身長羈於遠邦,兩耳久曠于雅言。然夫文章者吾之所宿好,程式者偶承時人之謬譽。故希孟不慚年少,莊生不望無涯。乃作斯言。誠未能嘔瀝長吉之心血,亦庶幾免於義山之流沫。既成之後,復學干將鑄劍而自飼,越王嚐糞而當先。自謂偶追《十書》之筆意,但恨少八家之淋漓。此子山所謂士衡撫掌而甘心,平子見陋而固宜。然則雖實覆甕之質,尚存斧正之望;雖乏呂相之金,易字之渴蓋同。此亦開源之大義,吾輩之所以勉勵也。一笑。
Wenyan:
吾有一數。曰三。名之曰「甲」。
為是「甲」遍。
吾有一言。曰「「問天地好在。」」。書之。
云云。
Equivalent JavaScript:
var n = 3;
for (var i = 0; i < n; i++) {
console.log("問天地好在。");
}
Output:
問天地好在。
問天地好在。
問天地好在。
Punctuations and newlines are completely optional (just like they are in Classical Chinese), so the above code is equivalent to:
吾有一數曰三名之曰「甲」為是「甲」遍吾有一言曰「「問天地好在」」書之云云
More sophisticated examples, such as the Sieve of Eratosthenes, Quicksort, Mandelbrot set, and Tower of Hanoi, can be found in the ./examples folder.
- Natural Language Programming sharing the grammar of Classical Chinese
- Compiles to JavaScript, Python, or Ruby
- Turing complete
- An Online IDE
- Examples to get started
- A packages manager wyg(文淵閣) and awesome packages from the community.
Install the compiler by
npm install -g @wenyan/cli
Try run the included examples, e.g.:
wenyan examples/helloworld.wy
# will output: 問天地好在。
You can now translate JavaScript to wenyan-lang using the wenyanizer by zxch3n.
Check out our Wiki pages
数据统计
相关导航
An Introduction to Programming in Wenyan Language
「殆知阁」中国古代文献原始数据
「中国古典文献全文检索引擎」是一个专门用于检索中华传统典籍的现代化搜索平台。我们致力于让古代智慧在数字时代焕发新的光彩,为研究者、学者和传统文化爱好者提供便捷、精准的文献检索服务。
Universal Viewer
Universal Viewer (UV) 是一个由社区开发的开源项目。我们的使命是帮助您与世界分享您的内容。
萌典網站 moedict-webkit
萌典共收錄十六萬筆臺灣華語、兩萬筆臺灣台語、一萬四千筆臺灣客語條目,並支援「自動完成」功能及「%_ *? ^.$」等萬用字元。定義裡的每個字詞都可以點擊連到說明。源碼、其他平台版本、API 及原始資料等,均可在 GitHub 取得。
Dezoomify
Dezoomify可以从在线可缩放图像界面提取完整的高分辨率图像。它支持来自多个不同网站的多种可缩放图像工具(参见下方列表)。它以可缩放图像的 URL 作为输入,并输出可供下载的图像(右键单击图像,然后选择“图像另存为... ”)。
NTI Buddhist Text Reader
Join the world's most widely adopted, AI-powered developer platform where millions of developers, businesses, and the largest open source community build software that advances humanity.
Open Library
开放图书馆(Open Library)是一个开放的、可编辑的图书馆目录,为有史以来出版的每本书建立一个网页。
BookReader
Internet Archive BookReader 用于在线查看 Internet Archive 中的书籍,也可用于查看其他书籍。




