C++ popularity, Lisp simplicity unite in Clasp compiler

The new implementation allows Lisp programmers to interoperate with C++ libraries and code

transparent binary code binary code computer coding technical programming 000000123354
Credit: iStockphoto

The power and simplicity of the Lisp family of languages and the ubiquity and utility of C++ don't commonly work side by side. But a new implementation of Common Lisp is attempting to change that.

Clasp, the project of Temple University chemistry professor Christian Schafmeister, is a version of Common Lisp that "interoperates with C++ and uses LLVM for JIT (just-in-time) compilation to native code," according to the GitHub page for the project.

In a blog post announcement for the first release of the project, Schafmeister notes that the goal with Clasp was to allow the power and expressiveness of Common Lisp to leverage the wide range of libraries made available through C++. "Common Lisp has many language features that have not yet made it into the C++ standard," he notes, so a number of the language's features involve the interoperation between C++ and Lisp.

Clasp can interface with the LLVM C++ library, Schafmeister claims, to allow automatic cleanup and refactoring of existing C++ code, as well as creating new compilers for LLVM in Clasp.

The LLVM compiler framework has been used to juice up a number of language implementations. Apple's using it to power a new JavaScript compiler, for example; a new Python implementation called Pyston is being built with LLVM as well.

Over the last few years, there's been broadening recognition of both Lisp and its influence on languages. The concept of lambdas/closures, for instance, has its roots in Lisp, and new languages have been taking Lisp's concepts and updating them for present-day users -- such as Clojure, a Lisp-like language built on the JVM.

Clojure hews closest to the Clasp vision. Built on top of the JVM, it provides programmers with access to the range of libraries available in Java, in much the same way Clasp is meant to interface with the world of C++ libraries.

Schafmeister warns that the first iteration of the language is quite primitive and untested. "The current Clasp compiler generates slow native code that is about 100x slower than highly tuned Common Lisp compilers like Steel Bank Common Lisp," he notes, and approximately 10 percent of the full list of Common Lisp symbols are not yet implemented. Multithreading isn't supported yet either, and Clasp doesn't build on Windows yet, only Linux and Mac OS X 10.9.

From CIO: 8 Free Online Courses to Grow Your Tech Skills
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.