CONSIDERATIONS ON PORTING PERL TO THE JAVA VIRTUAL MACHINE
The Java Virtual Machine (JVM) is perhaps the most interesting aspect of the Java programming environment. Much attention has been placed on porting non-Java languages to the JVM. Such ports are useful since JVMs are now embedded in hardware devices, as well as in software applications such as web browsers. In addition, well designed JVM ports can utilize the JVM as a common object model for multiple languages, allowing larger applications to easily be written in and scripted with multiple programming languages. This thesis presents a survey of possible approaches for porting non-Java languages to the JVM. The advantages and disadvantages of each approach are considered. Examples of JVM ports of other programming languages,such as Python, Scheme, and Tcl are presented and considered. The focus, however, is a port of Perl to the JVM. The internals of the existing Perl implementation are discussed at length with examples. The perl front-end parser, lexer and intermediate representation (IR) are described in detail. The default Perl compiler back-end, called the Perl Virtual Machine (PVM), is considered and described. Two approaches for porting Perl to the JVM are presented. The first approach reuses the existing perl front-end via Perl's B module to compile directly to JVM assembler (using Jasmin syntax). This approach is described and examples are given. The problems of mapping the PVM onto the JVM, the lack of generalization of the existing perl IR, and complications caused by the JVM bytecode verifier are introduced and explained. The second approach massages the existing perl IR into the Kawa system's more generalized IR. This approach is much more successful than direct compilation, and reasons are given to make that case. Kawa's IR is presented, and an example of a Perl program compiled to Kawa's IR is given. Finally, conclusions and lessons learned from this work are presented. A framework for the future work required to complete a Perl port to the JVM (via Kawa) is given. A brief comparison between the Kawa/JVM infrastructureand Microsoft's .NET/C# system is presented.
School:University of Cincinnati
School Location:USA - Ohio
Source Type:Master's Thesis
Keywords:jvm ports java virtual machine kawa infrastructure
Date of Publication:01/01/2001