文言 / wenyan‑lang
編程語言 Programming Language for the ancient Chinese
文言, 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:
// JavaScript
var 甲 = 3;
for (let _rand1 = 0; _rand1 < 甲; _rand1++) {
var _ans1 = "問天地好在。";
console.log(_ans1);
};
# Python
甲=3
for _rand1 in range(甲):
_ans1="問天地好在。"
print(_ans1);

# Ruby
甲=3
甲.times do |_rand1|
_ans1="問天地好在。"
p([_ans1].join)
end

Get

WIKI GITHUB ONLINE EDITOR LANGUAGE SPEC REFERENCE