One of the earliest documented languages in the ancient world was Sanskrit, which was written down by a man thousands of years ago.

His name was Pini, and his 4,000-some stras, or rules, are supposed to work like an algorithm that can generate correct words from a base and suffix.

Linguists have been trying to rebuild the language machine since Pini's Adhyy was written. It hasn't run as it should.

A PhD student at the University of Cambridge thinks he has solved the ancient puzzle, and his solution is easy to understand. It only changes the interpretation of one'metarule' outlined by Pini and the machine runs by itself.

Rajpopat was inspired by his nine months of working on the Pini problem for his master's thesis.

He recalls that he was close to quitting.

Vincenzo Vergiani, a professor of Asian and Middle Eastern studies at the University of Cambridge, reminded Rajpopat of an important principle of problem-solving.

Rajpopat said he closed the books for a month and enjoyed the summer.

"Then, begrudgingly, I went back to work, and, within minutes, as I turned the pages, these patterns began to emerge, and it all started to make sense."

Rajpopat has clearly laid out why Pini's engine had previously stopped.

It's not always clear which rule should win out when using Pini's guidelines.

Rajpopat has figured out which way the switch should turn.

The one rule of equal strength listed later in Pini's text has been argued against by other scholars.

Rajpopat doesn't think this is an accurate interpretation of Pini's metarule.

The linguist suggests that the rule that applies to the right side of a word should trump the rule that applies to the left side of a word.

It worked when Rajpopat tested Sanskrit words in this version of the engine.

It is a good example of a word. There is a Pini rule that applies to the left and right parts of the guru.

The stem of the word remains the same under Rajpopat's interpretation, which is why the suffix of the word is changed to "guru".

Rajpopat wrote in his thesis that "Pini's style is not entirely self-evident, and one faces challenges at multiple levels when attempting to untangle the Adhyy."

The stra style in which Pini's rules are composed makes it difficult to determine their meanings. A lot of information is packed into a few words so it's hard to comprehend.

Words in a rule can slip into another rule.

Rajpopat believes that Pini intended for the Adhyy to be interpreted linearly and as a closed grammatical machine.

The machine can run on its own meta rules without the need for scholars to add padding for exceptions, according to his work.

Rajpopat's thesis is called In Pini We Trust: discovering the Algorithm for Rule Conflict Resolution in the Astdhyy'.

He didn't expect us to change anything. The more we fiddle with Pini's language, the harder it is to understand.

Scientists have been trying to create a computer program using Pini's rules for a long time. Rajpopat's discovery could be the key to success.

The sacred language of Hinduism is Sanskrit. Understanding how it is structured can help experts not only read important historical documents with more accuracy, but it can also reveal important insights into the foundations of human language itself.

Vergiani says that his student has solved a problem that has perplexed scholars for centuries.

At a time when interest in the language is on the rise, this discovery will change the way Sanskrit is studied.

The thesis is online at the University of Cambridge.