Fundamentals 6 min read

Explore Wenyan‑lang: The Chinese‑Only Programming Language Without English Syntax

Wenyan‑lang, a novel programming language created by a Carnegie Mellon senior, lets developers write code using only traditional Chinese characters and punctuation, offering a unique way to express variables, control flow, functions, and data structures with side‑by‑side JavaScript equivalents illustrated throughout the article.

Programmer DD
Programmer DD
Programmer DD
Explore Wenyan‑lang: The Chinese‑Only Programming Language Without English Syntax

Introduction

Wenyan‑lang is a programming language created by a senior Carnegie Mellon University student that uses only traditional Chinese characters and Chinese quotation marks, completely avoiding English symbols.

Hello World

The classic “Hello World” program in Wenyan looks like the image below.

The equivalent JavaScript code is shown in the next image.

Language Overview

Common syntax patterns in Wenyan and their JavaScript counterparts are presented below. 吾有一數。曰三。名之曰「甲」。

var a = 3;
有數五十。名之曰「大衍」。

var dayan = 50;
昔之「甲」者。今「大衍」是也。

a = dayan;
吾有一言。曰「「噫吁戲」」。名之曰「乙」。

var b = "alas!";
吾有一爻。曰陰。名之曰「丙」。

var c = false;
吾有一列。名之曰「丁」。

var d = [];
吾有三數。曰一。曰三。曰五。名之曰「甲」曰「乙」曰「丙」。

var a = 1, b = 3, c = 5;

Control Flow

若三大於二者。乃得「「想當然耳」」也。

if (3 > 2) { return "of course"; }
若三不大於五者。乃得「「想當然耳」」。若非。乃得「「怪哉」」也。

if (3 <= 5) { return "of course"; } else { return "no way"; }
為是百遍。⋯⋯ 云云。

for (var i = 0; i < 100; i++) { ... }
恆為是。⋯⋯ 云云。

while (true) { ... }
凡「天地」中之「人」。⋯⋯ 云云。

for (var human of world) { ... }
乃止。

break;

Arithmetic

加一以二。

1 + 2
加一於二。

2 + 1
加一以二。乘其以三。

(1 + 2) * 3
除十以三。所餘幾何。

10 % 3
減七百五十六以四百三十三。名之曰「甲」。

var a = 756 - 433;
夫「甲」「乙」中有陽乎。

a || b
夫「甲」「乙」中無陰乎。

a && b

Containers

吾有一列。名之曰「甲」。充「甲」以四。以二。

var a = []; a.push(4, 2);
銜「甲」以「乙」。以「丙」

a.concat(b).concat(c);
夫「甲」之一。

a[0];
夫「甲」之其餘。

a.slice(1);
夫「玫瑰」之「「名」」。

rose["name"];
夫「寶劍」之長。

sword.length;

Functions

吾有一術。名之曰「吸星大法」。是術曰。⋯⋯是謂「吸星大法」之術也。

function f() { ... }
吾有一術。名之曰「六脈神劍」。欲行是術。必先得六數。曰「甲」。曰「乙」。曰「丙」。曰「丁」。曰「戊」。曰「己」乃行是術曰。⋯⋯是謂「六脈神劍」之術也。

function f(a,b,c,d,e,f) { ... }
吾有一術。名之曰「翻倍」。欲行是術。必先得一數。曰「甲」。乃行是術曰。乘「甲」以二。名之曰「乙」。乃得「乙」。是謂「翻倍」之術也。

function double(a) { var b = a * 2; return b; }

Resources

More detailed information about Wenyan‑lang can be found on its official website: http://wenyan-lang.lingdong.works/

An online editor is also available at: http://wenyan-lang.lingdong.works/ide.html

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Programming LanguageCode Exampleswenyan-langchinese-syntax
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.