文言, or
wenyan, is an esoteric programming language that closely follows the grammar and tone of classical Chinese literature. Moreover, the alphabet of
wenyan contains only traditional Chinese characters and
「」
quotes, so it is guaranteed to be readable by ancient Chinese people. You too can try it out on the
online editor,
download a compiler, or view the
source code.
Syntax
Syntax of
wenyan is just like that of its namesake, classical Chinese:
天地,好在否!/ HELLO WORLD ▶︎
The code above is editable, go ahead customize the greeting and hit ▶︎! Another slightly more sophisticated example, using the sieve of Erathosthenes to find prime numbers:
埃氏筛 / SIEVE OF ERATOSTHENES ▶︎
You can find many more examples such as a Universal Turing Machine, a Mandelbrot set plotter, a Tower of Hanoi solver, and so on on the
online IDE.
Compilation
wenyan currently compiles to JavaScript, Python, or Ruby, and will support more languages (e.g. C) in the future. The Hello World example (or whatever you edited it to be) above translates to:
Get
WIKI
GITHUB
ONLINE EDITOR
LANGUAGE SPEC
REFERENCE