In this chapter we have seen how to compile small languages, like regular expressions, and bits and pieces of larger languages. These and many other languages can be implemented using the Java virtual machine.
There are a variety of reasons to implement other languages in JVM code. Each language has its own flavor. Each programmer has a favorite language. Different programming tasks are better suited to different languages. By implementing compilers for these languages into JVM code, you can gain much of Java's "Write Once, Run Anywhere" capability for any language.
In succeeding chapters, we explore compilers for two languages, Scheme and Prolog. These languages are very different from Java. Scheme is based on the idea of using functions as data. Prolog is based on the idea of using rules to specify program implementations. Certain tasks can be implemented in these languages better than in any other language, including Java. The next chapters discuss in detail how to implement these languages on the Java virtual machine.
For an interesting discussion of extending Java to support other language features, visit http://wwwipd.ira.uka.de/~pizza. This site discusses Pizza and GJ, two extended Java languages, which compile into bytecodes.