wenyan

From Esolang
(Redirected from Wenyan-lang)
Jump to navigation Jump to search

wenyan (文言) is a language created by LingDong- in 2019. The language is Turing Complete. Wenyan-lang use classical Chinese as its source code. It currently has multiple backends including JavaScript, Python, and Ruby.

Code Samples

Hello World:

吾有一言。曰「「Hello World」」。書之。

99 bottles of beer simulator:

吾有一言。曰「「春日宴。」」。書之。
有數九。名之曰「酒數」。

恆為是。若「酒數」等於零者乃止也。

	吾有三言。曰「「與君」」。曰「酒數」。
		曰「「杯酒。可以窮歡宴。綠酒一杯歌一遍。」」。書之。

減「酒數」以一。昔之「酒數」者。今其是矣云云。

吾有一言。曰「「綠酒千杯腸已爛。」」。書之。

In English:

有數九九。名之曰「a」。
恆為是。
 若「a」小於三者乃止也。
 減「a」以一。
 有數一。名之曰「z」。昔之「z」者。今其是矣。
 吾有六言。
  曰「a」。
  曰「「bottles of beer on the wall,」」。
  曰「a」。
  曰「「bottles of beer.\nTake one down and pass it around,」」。
  曰「z」。
  曰「「bottles of beer on the wall.\n」」。
 書之。
 昔之「a」者。今「z」是矣
云云。
吾有一言。曰「「2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake one down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.」」。書之。

This one print Fibonacci sequence from 1 to 10.

有數一。名之曰「代」。
有數零。名之曰「母」。
有數一。名之曰「子」。
有數零。名之曰「实」。

恆為是。若「代」大於十者乃止也。
    加「母」以「子」。昔之「实」者。今其是矣。
    夫「代」,夫「「代:」」,夫「实」,書之。
    昔之「子」者。今「母」是矣。
    昔之「母」者。今「实」是矣。
    加「代」以一。昔之「代」者。今其是矣。
云云。

Mandelbrot set code:

吾有一術。名之曰「曼德博」。欲行是術。必先得二數。曰「寬」。曰「高」。乃行是術曰。
	批曰。「「曼德博集。亦稱曼德布洛特复数集合。复平面上组成分形之点之集合也。」」

	吾有一言。曰「「丁龘蠹臺龜畫龍淼蔑高五三二」」。名之曰「皴法」。
	批曰。「「皴法者。圖畫之法也」」。

	減零以一。名之曰「上」。加零以一。名之曰「下」。
	減零以二。名之曰「左」。加零以二。名之曰「右」。

	減「右」以「左」。除其以「寬」。名之曰「橫步」。
	減「下」以「上」。除其以「高」。名之曰「縱步」。

	有數零。名之曰「戊」。恆為是。若「戊」等於「高」者乃止也。

		乘「縱步」以「戊」。加其以「上」。以名之曰「虛」。

		吾有一言。名之曰「行」。

		有數零。名之曰「戌」。恆為是。若「戌」等於「寬」者乃止也。

			乘「橫步」以「戌」。加其以「左」。名之曰「實」。

			夫「虛」。名之曰「虛虛」。
			夫「實」。名之曰「實實」。

			批曰。「「凡每一像素。皆算令其收斂之最大疊代數」」。

			有數零。名之曰「己」。恆為是。若「己」等於十二者乃止也。

				乘「實實」以「實實」。乘「虛虛」以「虛虛」。名之曰「甲」。曰「乙」。
				加「甲」以「乙」。名之曰「丙」。
				若「丙」大於四者乃止也。

				乘「虛虛」以「實實」。乘其以二。加其以「虛」。昔之「虛虛」者。今其是矣。
				減「甲」以「乙」。加其以「實」。昔之「實實」者。今其是矣。

			加一以「己」。昔之「己」者。今其是矣云云。

			批曰。「「既得疊代數。乃以皴法圖之」」。

			減十三以「己」。名之曰「巳」。
			夫「皴法」之「巳」。名之曰「墨」。
			加「行」以「墨」。昔之「行」者。今其是矣。

		加一以「戌」。昔之「戌」者。今其是矣云云。

		吾有一言。曰「行」。書之。
	加一以「戊」。昔之「戊」者。今其是矣云云。
是謂「曼德博」之術也。

批曰。「「畫曼德博集合之法。至是盡矣。乃一試之」」。

施「曼德博」於五十九。於二十四。

批曰。「「This programming language currently doesn't support standard input.」」。


Powers of 2:

有數一。名之曰「z」。
有數百。名之曰「a」。
恆為是。若「a」等於零者乃止也。
	減「a」以一。昔之「a」者。今其是矣。
	吾有一言。曰「z」。書之。
	乘「z」以二。昔之「z」者。今其是矣。
云云。

External resources