It’s good coding: Computer Science Students Drawn to Sanskrit

Credit: University of Toronto

Libbie Mills, an assistant professor in the department for the study of religion in the University of Toronto’s Faculty of Arts & Science, noticed something interesting this fall in her introductory Sanskrit class: computer science students.Credit: University of Toront

The course typically attracts students majoring in the study of religion, who are learning the language to further their research into Hinduism, Buddhism and Sikhism. Reading through her class list, however, Mills found that of six of the 40 enrolled students were actually computer science majors.

“I'm always excited when there are students from an unexpected place,” she says.

The lingual connection between Sanskrit and computer science, it turns out, has been the subject of interest for quite some time. The first well-known publication that examined the relationship was in 1985, when NASA scientist Rick Briggs published a research paper in which he argued that the 3,500-year-old language was the best candidate for programming artificial intelligence technology – namely because of its adherence to rigid grammatical rules.

Paul Thomas, a fourth-year undergraduate student at St. Michael’s College who plans on majoring in computer science next year, says he has a proclivity for learning languages, but ultimately took the course because of its connection to coding.

“Sanskrit is a very computational language,” he explains. “It’s a lot of syntax, which is the structure of programming itself. Classical Sanskrit is an engineered language.”

There are nearly 4,000 rules recorded in the fourth century BCE grammar of Pāṇini, an ancient scholar of the language – and Mill’s approach to teaching it is methodical.

“I'm a nerd” she says. “I like mathy type things, and I teach in a bit of a sciencey way.”

She stresses to her students that this is not a typical language class, where after a few classes they’ll be able to casually practise what they have learned over coffee.

“It’s not conversational, there’s too much to learn at the beginning,” she says. “They must learn the characters and how words get put together. It’s mind-bogglingly awful at first.”

She starts with what she calls the building blocks – “the order of sounds we produce out of our mouths ... from the throat to palate to teeth to lips” – and enthuses over the “tidiness of the language”, where a few root words are the basis of the entire Sanskrit vocabulary.

“It's orderly,” Mills says. “If you know the systems for making words you can work backward to the root to understand the meaning of the word. It’s creative in an organized way. It is kind of amazing.”

Mills adds that she understands the affinity that computer programmers have with the language. “It’s good coding,” she says.

For Thomas, the strict grammatical rules of Sanskrit align well with the goals of computer programmers who are ultimately interested in the “question of how to create interface between computers and human languages.”  He maintains that Sanskrit is well positioned to do so because of its algorithmic foundation. “Computers don’t understand linguistics, they understand rules,” he says.

In addition, the rigidity of Sanskrit makes it less likely that an artificial intelligence algorithm would misinterpret commands. The same can’t be said of a language like English, which is looser with its rules and where words have multiple meanings.

“In English, there are so many influences from different language streams,” Mills says. “It’s kind of a mess.”

Credit: University of Toront