Charles Q. Choi writes for Spectrum about an unusual new programming language:

The world’s first programming language based on classical Chinese is only about a month old, and volunteers have already written dozens of programs with it, such as one based on an ancient Chinese fortune-telling algorithm.

The new language’s developer, Lingdong Huang, previously designed an infinite computer-generated Chinese landscape painting. He also helped create the first and so far only AI-generated Chinese opera. He graduated with a degree in computer science and art from Carnegie Mellon University in December.

After coming up with the idea for the new language, wenyan-lang, roughly a year ago, Huang finished the core of the language during his last month at school. It includes a renderer that can display a program in a manner that resembles pages from ancient Chinese texts.

“I always put it off and tried to read more books in classical Chinese. Eventually I decided that reading more books might be just a euphemism for procrastination, and I needed to just implement it,” Huang says.

I know the feeling! There is more description at the link, little of which I can understand, and some gorgeous illustrations. I have no idea if this is useful or just a jeu d’esprit, but I’m glad to know about it. Thanks, Trevor!


  1. Yeah nah nah. The world doesn’t need any more programming languages; it needs far fewer (providing that includes my favourites, of course).

    There’s a whole wiki page on ‘Esoteric Programming Language’s, with many links. It’s not clear if ‘wenyan-lang’ is more-or-less a familiar language with the keywords re-spelt in Chinese characters (which option was part of the design of ALGOL 60); or it embodies some different thought patterns in some Sinitic topolect Sapir-Whorf style. I suspect it’s Java in Chinese clothing, considering how many transpilers are coming along.

    The more interesting part of the article is implementing algorithms from ancient treatises. But I see no discussion of whether this needs different thought-patterns.

    “wenyan-lang goes from the longest keyword to the shortest keyword in each program to decipher what the programmer wants” is what language standards call the ‘maximal munch rule’. Again ALGOL 60 famously had an (unintended) ambiguity in its syntax, to which that was the resolution.

  2. Victor Mair looked into this at Language Log. The verdict: “a sinocentric exercise in nerdiness.” Does the world need this? Well, does it need, say, a novel written without the letter e? It’s a game.

  3. Lars Mathiesen says

    @AntC: As we know, real programmers can code FORTRAN IV in any language. Problem solved!

  4. Stu Clayton says

    “wenyan-lang goes from the longest keyword to the shortest keyword in each program to decipher what the programmer wants”

    That is about as dorky as a formulation can get, and also seems to imply a stupidity in the language. By the latter I refer to this: are some keywords really concatenations of other keywords ?? Does the lexer have to take this into account ? Does the lexer jump backwards and forwards to identify tokens ? How weird.

    Note well that this is about keywords, not other constructs. Smalltalk takes the “longest syntactically legal sequence of method name fragments” to identify the method. For example,

    from: 1 to: 3.

    identifies from:to: (Notice the <dot> statement terminator at the end) This is like a Java method invocation fromto(1, 3).


    from: 1+2.

    identifies from:

    That means that if what you want instead of (A) is

    (from: 1) to: 3.

    then you must write it that way. This is like a chain of method invocations from(1).to(3) in Java.

    Smalltalk is like other interpreted, untyped languages (shudder!) in that you have no help from the compiler in finding mistakes. You can test only at runtime.

    I’ll just add that “what the programmer wants” is undecidable, since many programmers can’t tell you what they want. That is, their inarticulateness makes it impossible for them to describe what they want by any means other than the unintelligible code they write.

  5. Lars Mathiesen says

    Preach it, brother!

  6. Does the world need this? Well, does it need, say, a novel written without the letter e? It’s a game.

    Well said.

  7. ALGOL 60 famously had an (unintended) ambiguity in its syntax

    Most of the commoni programming languages used today have the same ambiguity, and for that matter it’s expressible in English: “If I were a moose then if you were a cow you would love me anyhow, otherwise we’d listen to Fred Small songs.” It’s not clear whether the otherwise-clause (spelled else by programmers for brevity) binds to the first if-clause or the second one; programming languages assume the second one and require the introduction of marks of parenthesis (usually braces nowadays) to disambiguate.

    (from: 1) to: 3.

    In Self, an offshoot of Smalltalk, multiple-keyword messages require all keywords but the first to be capitalized, so that “from: 1 to: 3” means the same as the parenthesized version, and the multi-keyword version is “from: 1 To: 3”. This takes some getting used to, but eventually becomes second nature. Then again, so does Lisp (Lisp programmers don’t read parentheses, they read indentation just like all other programmers).

  8. Stu Clayton says

    Ah, I had forgotten (if I ever knew) that the parts of messages requiring one or more arguments are called “keywords”. I don’t remember calling them “keywords”, but then all this took place in Germany. Maybe that is what the wenyan-lang quote is about.

    It’s good to see that after 20 years of Java, even Smalltalk basic terminology is gradually fading from my mind. Before that I worked for 10 years in large Smalltalk projects, and now look back in horror. Why did I do it ? Partly because of the hourly fee of 200 DM, I guess.

    Almost all of these large projects collapsed under the weight of their own code after a few years. Nobody could understand (anybody know about doesNotUnderstand: ?) any more how it all worked. Everybody had added their special tricks. What can you say to a language that allows you to extend system classes ?

  9. I say the same thing I say when working in Python: code review and unit tests. Sharp tools cut, as they say, but that’s no reason to blunt your tools in advance.

  10. Lars Mathiesen says

    What can you say to a language that allows you to extend system classes ?

    Extend: neat, more power to the people. Invisibly change behaviour: Back away from the keyboard, please, very slowly and don’t make any sudden moves.

  11. Stu Clayton says

    By extend I didn’t mean subclassing. I meant, for example, adding messages to String so that any string “behaves” like an Address. The only downside is that strings that don’t have the required structure would behave like addresses in an earthquake. But wait ! The programmer has used doesNotUnterstand: in his address-behavior-string code to delegate the message sends to Integer, because that’s where another part of Address is implemented. Address itself is what we fondly know as Schall und Rauch.

    If this sounds like gobbledygook – it was and is !! And if you didn’t lose your marbles dealing with it, you got paid astronomical sums. In fact, Smalltalk jobs in Germany 20 years on probably pay stellar again, just like Cobol jobs around Y2K (as rumor had it, anyway). There’s one VERY LARGE company that is stuck with a Smalltalk implementation of a business-critical app that calculates and displays **** (can’t tell you what, that would give the game away). For years they have been desperately trying to find programmers.

    But I would rather wash dishes.

  12. Lars Mathiesen says

    Address like in street address? Now, that’s … special. They can keep their code and good luck.

  13. John Cowan says

    Well, some cases of adding methods to system classes are quite benign. For example, the best way to write a dynamic type predicate for class Foo is to have a method isFoo in class Foo that returns true, in which case one must add the same method to class Object that returns false. Of course, one can check directly whether an object’s class is Foo, but that will not work if Foos may in fact be of class Foo1 or Foo2 (where neither is a subclass of the other). Then the method that returns true can be placed into both classes.

    There simply are no programming languages that make it impossible to make a mess of one’s code. Used with discipline and taste, dynamically typed languages are as usable and intelligible as any other.

  14. Graham Asher says

    It doesn’t look like a new language to me, at first glance. I don’t read Chinese, but it seems very probable, looking at the image of the Wenyan-lang programming window and corresponding JavaScript, that it can be mapped almost token-by-token to JavaScript, and shares the same semantics, and thus is effectively JavaScript with Chinese keywords and operators and some minor syntactic reordering.

Speak Your Mind