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. "It was finals week and there were no classes. So instead of studying, I used the bulk of free time to implement wenyan-lang, finishing the core functionality within three or four days."

Growing up in Shanghai, Huang learned basic classical Chinese in school. "I got quite fascinated by the language and read more books in classical Chinese on my own as a teenager," he recalls. "Currently I'm reading the Huainanzi," an ancient Chinese exploration of philosophy and statecraft compiled at the court of the king of Huainan in the 2nd century BC.

Lingdong Huang Lingdong Huang

There are already dozens of programs written in wenyan-lang, about half of which others wrote, Huang says. "Many of them are implementations of mathematical algorithms found in ancient Chinese math books. For example, pi_liuhui.wy recreates how 3rd-century AD mathematician Liu Hui calculated pi. Crt.wy is the Chinese remainder theorem. Pascal_triangle.wy computes Pascal's Triangle, which was described in Chinese books prior to Pascal's discovery."

One of Huang's favorite programs in wenyan-lang, he says, "is divination.wy. It is the fortune-telling algorithm described in the I-Ching," the oldest of the Chinese classics. He adds: "I was going to implement it myself, but an enthusiastic contributor beat me to it."

Wenyan-lang uses both traditional Chinese characters and classical Chinese grammar. One challenge in developing the language was how classical Chinese does not use spaces to divide sentences into words, "so how to split a sentence is a task of the reader and not the writer," Huang says. For example, if readers literate in English saw "pancakebatter," they would have to rely on their prior knowledge to decipher that as "pancake batter" and not "pan cake batter."

A rendering of the divination.wy program written in wenyan-lang. Image: Lingdong Huang

To overcome this challenge, Huang notes that programming languages only possess a set amount of keywords. As such, wenyan-lang goes from the longest keyword to the shortest keyword in each program to decipher what the programmer wants, "and it works," Huang says.

Huang was surprised and excited by the amount of attention wenyan-lang has received. "I thought I made a lot of cool projects before, but this one somehow became especially popular in China," he says.

"Before this I largely worked on my own at my own pace, but now collaboration has become crucial," Huang says. "In addition to co-authoring code, I have to review other people's code, carefully evaluate every suggestion, and decide if they're indeed valuable features for the language, or write friendly responses to explain why I don't think so if otherwise. But I think I'm enjoying the experience, especially since I've got a gang of amazing contributors."

Wenyan-lang programming window and corresponding JavaScript. Image: Lingdong Huang

Currently wenyan-lang contributors are working on transpilers for Python, Ruby, JavaScript, C++, and Java, libraries for graphics and the graphical user interface (GUI), as well as a snippet site where people can author and share bits of code. "Most importantly, we're seeking ways to build a community around the language," Huang says. "I think this might be a critical moment for its survival. People have the initial enthusiasm, but to keep the language alive, there needs to be a community of users."

In addition, Huang is currently working on an introductory guide to programming in wenyan-lang that is itself written in classical Chinese. "It is about 40 percent done," he says. "The target audience of the book can be someone with no prior experience with programming at all. However I'll need to test it with the aforementioned audience to make sure, as I believe some ideas that are natural to me might not be obvious to someone new to programming."

All in all, "now I have a programming language of my own, a language that is exactly how I want it to be, and in classical Chinese, which I very much enjoy," Huang says. "I think inventing one's own programming language is an idea that pops up in the mind of every programmer. (This best explains the plethora of programming languages today.)"

The Conversation (0)
Sort by

The Future of Deep Learning Is Photonic

Computing with light could slash the energy needs of neural networks

10 min read

This computer rendering depicts the pattern on a photonic chip that the author and his colleagues have devised for performing neural-network calculations using light.

Alexander Sludds
DarkBlue1

Think of the many tasks to which computers are being applied that in the not-so-distant past required human intuition. Computers routinely identify objects in images, transcribe speech, translate between languages, diagnose medical conditions, play complex games, and drive cars.

The technique that has empowered these stunning developments is called deep learning, a term that refers to mathematical models known as artificial neural networks. Deep learning is a subfield of machine learning, a branch of computer science based on fitting complex models to data.

Keep Reading ↓ Show less

This AI Can Predict Heart Attack Risk From an Eye Scan

The method detects subtle changes in affordable and widely available retinal scans

4 min read
Optometrist giving eye exam to senior patient
Bill Oxford/Getty Images

A heart attack might seem like a completely random event, but there are signs when a person might be at risk. What if you could pick up on these signs from a simple, relatively cheap scan of a person’s eye?

“You get it every time you go to [get] a pair of glasses,” said Alex Frangi, a professor of computing and medicine at the University of Leeds, in England. “So that would be really cool.”

Keep Reading ↓ Show less

Following the Money in the Air-Taxi Craze

Are eVTOLs the “mother of all aerospace bubbles”?

8 min read
A Joby Aviation Inc. electric vertical take-off and landing aircraft outside the New York Stock Exchange.

Joby Aviation displayed one of its S4 aircraft outside the New York Stock Exchange on 11 August 2021, the day of the company's initial public offering.

Michael Nagle/Bloomberg/Getty Images

When entrepreneur JoeBen Bevirt launched Joby Aviation 12 years ago, it was just one of a slew of offbeat tech projects at his Sproutwerx ranch in the Santa Cruz mountains. Today, Joby has more than 1,000 employees and it’s backed by close to US $2 billion in investments, including $400 million from Toyota Motor Corporation along with big infusions from Uber and JetBlue.

Having raked in perhaps 30 percent of all the money invested in electrically-powered vertical takeoff and landing (eVTOL) aircraft so far, Joby is the colossus in an emerging class of startups working on these radical, battery-powered commercial flyers. All told, at least 250 companies worldwide are angling to revolutionize transportation in and around cities with a new category of aviation, called urban air mobility or advanced air mobility. With Joby at the apex, the category’s top seven companies together have hauled in more than $5 billion in funding—a figure that doesn’t include private firms, whose finances haven’t been disclosed.

Keep Reading ↓ Show less

Why the Sapphire Clock Outshines Even the Best Atomic Clocks

Breakthrough oscillator could set the pace for quantum computers

10 min read
Brent Lewin/Redux
LightBlue

Tick, tick, tick. The rhythm of clocks is universal. But how exactly alike are those ticks? For some vital applications, even vanishingly small deviations can be a problem.

For those applications, help is on the way, in the form of the most precise clock yet created. Developed by Andre Luiten when he was completing his studies at the University of Western Australia, it's built around a small, extremely cold crystal of sapphire. Luiten calls it the Cryogenic Sapphire Oscillator, and it could bolster technologies as varied as military radar and quantum computing. He and his colleagues are working on these applications at the University of Adelaide, also in Australia, where he now serves as director of the Institute for Photonics and Advanced Sensings.

Keep Reading ↓ Show less

Q&A: Here’s How AI Will Change Chip Design

MATLAB product manager discusses AI's promise and potential for the semiconductor industry

5 min read
Layered rendering of colorful semiconductor wafers with a bright white light sitting on one.

An array of semiconductor wafers are ready to be made into chips.

MirageC/Getty Images

The end of Moore’s Law is looming. Engineers and designers can do only so much to miniaturize transistors and pack as many of them as possible into chips. So they’re turning to other approaches to chip design, incorporating technologies like AI into the process.

Samsung, for instance, is adding AI to its memory chips to enable processing in memory, thereby saving energy and speeding up machine learning. Speaking of speed, Google’s TPU V4 AI chip has doubled its processing power compared with that of its previous version.

Keep Reading ↓ Show less

Using the exida Component Reliability Database for New Product Design and Development

Component reliability database takes FMEDAs to a new level of efficiency and accuracy

1 min read

Failure Modes, Effects, and Diagnostics Analysis (FMEDA) set the standard for calculating safety and reliability of automatic protection systems to IEC61508. FMEDA results, however, are only as good as the failure rate data that is used to create them. A new component reliability database (CRD) overcomes limitations and improves accuracy.

Eviation’s Maiden Flight Could Usher in Electric Aviation Era

Disrupting the entire industry will take more than one flight, however

4 min read
A white nine-seater aircraft sits on a runway at dusk. An airport marshaller in a reflective vest holds up two light sticks in front of it.
Eviation

The first commercial all-electric passenger plane is just weeks away from its maiden flight, according to its maker Israeli startup Eviation. If successful, the nine-seater Alice aircraft would be the most compelling demonstration yet of the potential for battery-powered flight. But experts say there’s still a long way to go before electric aircraft makes a significant dent in the aviation industry.

The Alice is currently undergoing high-speed taxi tests at Arlington Municipal Airport close to Seattle, says Eviation CEO Omer Bar-Yohay. This involves subjecting all of the plane’s key systems and fail-safe mechanisms to a variety of different scenarios to ensure they are operating as expected before its first flight. The company is five or six good weather days away from completing those tests, says Bar-Yohay, after which the plane should be cleared for takeoff. Initial flights won’t push the aircraft to its limits, but the Alice should ultimately be capable of cruising speeds of 250 knots (463 kilometers per hour) and a maximum range of 440 nautical miles (815 kilometers).

Keep Reading ↓ Show less