Wyvern program allows use of multiple languages at once

If you’ve ever programmed in more than one programming language, chances are that you’ve sometimes wished you could use multiple languages in the same program, because what’s easy to do in one language might be hard or impossible to do in another. A team of researchers, led by Jonathan Aldrich, associate professor in the Institute for Software Research, has been working on solving just this problem.
The group is developing a new programming language called Wyvern that makes it much easier to write web applications. Wyvern allows programmers to use HTML, the language in which web pages are written; JavaScript, which makes web pages dynamic; SQL, in which database queries are performed; and many other languages together in the same program.
Previous attempts to use multiple languages together have involved writing the code in one language and passing in snippets of code written in other languages as strings, which are data in the form of a sequence of characters. This practice is tedious as well as prone to many security flaws, which can make the program vulnerable to malicious attacks like cross-site scripting and SQL injection — the two most common types of attacks used by website hackers today.
Wyvern prevents these attacks by treating pieces of code written in different languages as new types of data, rather than strings. It is based on the idea of a type-specific language (TSL), which ensures that code is valid for the language that it is written in. Using this concept of TSLs, programmers can integrate code snippets from different languages in a clear and concise manner, making the resultant program much easier for other programmers to read and comprehend.
“Wyvern is like a skilled international negotiator who can smoothly switch between languages to get a whole team of people to work together. Such a person can be extremely effective and, likewise, I think our new approach can have a big impact on building software systems,” Aldrich said, in a Carnegie Mellon press release.
Using multiple languages in the same program has opened up many avenues. Cyrus Omar, a Ph.D. student in the School of Computer Science and the lead designer of Wyvern’s TSL approach, said via email that he feels that this new concept of “specialized syntax” will be useful in scientific programming.
“Each scientific area tends to come up with its own specialized forms (e.g. bra-ket notation in quantum physics) and allowing them to use them directly makes the gap between what they write up on whiteboards and what they put down into the computer narrower, improving productivity,” Omar said.
Another area where this idea is expected to make a great impact is in the field of end-user programming. “End users is a term used in the literature to describe the kinds of folks who might not even think they do any programming, but they use tools like spreadsheets or Wordpress templates,” Omar explained. “Making things easier for them syntactically by capturing common idioms, while retaining the nice semantics of a language like Wyvern underneath, would help bridge the gap between ‘professional programmers’ and ‘end user programmers’, which I think would be good for everyone involved.”
When asked whether he feels that Wyvern is something that may be widely used in industry, Omar replied, “The hope with projects like these is that our ideas, rather than the artifact itself, will have an impact on future language designs originating in industry.” He added, however, that Wyvern is being actively developed on GitHub, largely through the efforts of Benjamin Chung, a senior computer science major.
Programmers who are excited about Wyvern can start using it as well, contributing to the design of the language. “New languages gain adoption when people who are starting brand new projects, often side projects, make a decision to try something new,” Omar said.