Kawa: compiling dynamic languages to the Java VM

  • Authors:
  • Per Bothner

  • Affiliations:
  • Cygnus Solutions, Sunnyvale CA

  • Venue:
  • ATEC '98 Proceedings of the annual conference on USENIX Annual Technical Conference
  • Year:
  • 1998

Quantified Score

Hi-index 0.00

Visualization

Abstract

Many are interested in Java for its portable bytecodes and extensive libraries, but prefer a different language, especially for scripting. People have implemented other languages using an interpreter (which is slow), or by translating into Java source (with poor responsiveness for eval). Kawa uses an interpreter only for "simple" expressions; all non-trivial expressions (such as function definitions) are compiled into Java bytecodes, which are emitted into an in-memory byte array. This can be saved for later, or quickly loaded using the Java ClassLoader. Kawa is intended to be a framework that supports multiple source languages. Currently, it only supports Scheme, which is a lexically-scoped language in the Lisp family. The Kawa dialect of Scheme implements almost all of the current Scheme standard (R5RS), with a number of extensions, and is written in a efficient object-oriented style. It includes the full "numeric tower", with complex numbers, exact infinite-precision rational arithmetic, and units. A number of extensions provide access to Java primitives, and some Java methods provide convenient access to Scheme. Since all Java objects are Scheme values and vice versa, this makes for a very powerful hybrid Java/Scheme environment. An implementation of ECMAScript (the standardized "core" of JavaScript) is under construction. Other languages, including Emacs Lisp, are also being considered. Kawa home page: http://www.cygnus.com/ ~bothner/kawa.html.