Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
W

wenyan

> 编程语言
Open source

文言文編程語言 A programming language for the ancient Chinese.

20.3K stars0 likes1 views
WebsiteGitHub

About

文言文編程語言 A programming language for the ancient Chinese.

文言 wenyan-lang

wy-lang.org | Wiki | The Book

English | 简体中文 | 繁體中文

文言文編程語言。A programming language for the ancient Chinese. Try it online.

CHANGELOG

序

夫唐、虞之世,結繩而足治,屈指而足算。是時豈料百代之後,計算機械之巧,精於公輸之木鳶,善於武侯之流馬;程式語言之多,繁若《天官》之星宿,奇勝《山經》之走獸。鼠、蟹、鑽、魚,或以速稱。蛇、象、駱、犀,各爭文采。方知鬼之所以夜哭,天之所以雨粟。然以文言編程者 ,似所未有。此誠非文脈之所以傳,文心之所以保。嗟予小子,遂有斯志。然則數寸之烏絲猶覆於頭,萬卷之素書未破於手;一身長羈於遠邦,兩耳久曠于雅言。然夫文章者吾之所宿好,程式者偶承時人之謬譽。故希孟不慚年少,莊生不望無涯。乃作斯言。誠未能嘔瀝長吉之心血,亦庶幾免於義山之流沫。既成之後,復學干將鑄劍而自飼,越王嚐糞而當先。自謂偶追《十書》之筆意,但恨少八家之淋漓。此子山所謂士衡撫掌而甘心,平子見陋而固宜。然則雖實覆甕之質,尚存斧正之望;雖乏呂相之金,易字之渴蓋同。此亦開源之大義,吾輩之所以勉勵也。一笑。

Helloworld

Wenyan:

吾有一數。曰三。名之曰「甲」。
為是「甲」遍。
	吾有一言。曰「「問天地好在。」」。書之。
云云。

Equivalent JavaScript:

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.

Features

  • 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.

Try it out

The Online IDE

Text Editor Plugins

  • Plugin for VSCode by antfu
  • Plugin for Vim by voldikss
  • Plugin for Sublime Text by absop

Command Line Compiler

Install the compiler by

bash
npm install -g @wenyan/cli

Try run the included examples, e.g.:

bash
wenyan examples/helloworld.wy
# will output: 問天地好在。

The Decompiler

You can now translate JavaScript to wenyan-lang using the wenyanizer by zxch3n.

3rd Party Compilers

  • JVM compiler by MagicLu550

Documentation

Check out our Wiki pages

  • Syntax Cheatsheet
  • Standard Library Cheatsheet
  • Library Packages
  • Contributing
  • API Specifications
  • Browser Runtime
  • Feature Requests
  • Known Issues

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Issues· 216 open

View all issuesOpen on GitHub
  • #705

    Grok 3 正确理解了本项目的 Hello world

    Updated Sep 6, 2026
  • #716

    最难理解的编程语言(

    Updated Sep 6, 2026
  • #698

    你是懂整活的

    Updated Jul 9, 2026
  • #712

    議借大語言模型以廣文淵閣

    Updated Mar 31, 2026
  • #711

    告:已成文言 Python 獨立實作,並進自舉

    Updated Feb 11, 2026
  • #707

    逆天

    Updated Jan 25, 2026
  • #710

    [Share work] 誦《文言陰符》以中古漢語

    Updated Nov 28, 2025
  • #708

    hellow world风格简化改进建议

    Updated Nov 10, 2025
  • #678

    非常有趣

    Updated Oct 18, 2025
  • #706

    汉字的信息密度更高,适用于和 LLM 通信

    Updated Mar 18, 2025

> Tags

TypeScriptclassical-chineseesoteric-languageprogramming-languagewenyan-lang

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言