Abstract
A systematic method of compiling lazy functional programs based on the Spineless Tagless G-machine (STGM) is presented for the Java Virtual Machine (JVM). A new specification of the STGM, which consists of a compiler and a reduction machine, is presented; the compiler translates a program in the STG language, which is the source language for the STGM, into a program in an intermediate language called L-code, and our reduction machine reduces the L-code program into an answer. With our representation for the reduction machine by the Java language, an L-code program is translated into a Java program simulating the reduction machine.
The translated Java programs also run at a reasonable execution speed. Our experiment shows that execution times of translated benchmarks are competitive compared with those in a traditional Haskell interpreter, Hugs, particularly when Glasgow Haskell compiler’s STG-level optimizations are applied.
Acknowledgment
We thank anonymous referees for their many helpful comments. The first author also thanks Hyeon-Ah Moon for her encouragement. This work is supported by Advanced Information Technology Research Center.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
N. Benton and A. Kennedy. Interlanguage Working Without Tears: Blending SML with Java. In Proceedings of the 4th ACM SIGPLAN Conference on Functional Prgramming, pages 126–137, 1999.
N. Benton, A. Kennedy, and G. Russell. Compiling Standard ML to Java Bytecodes. In Proceedings of the 3rd ACM SIGPLAN Conference on Functional Prgramming, pages 129–140, 1998.
M. Campione and K. Walrath. The Java Tutorial (2nd Ed.). Addison Wesley, March 1998.
T. Lindholm and F. Yellin. The Java TM Virtual Machine Specification (2nd Ed.). Addison Wesley, 1999.
G. Meehan and M. Joy. Compiling Lazy Functional Programs to Java Bytecode. Software-Practice and Experience, 29(7):617–645, June 1999.
S. L. Peyton Jones. A Java Back End for Glasgow Haskell Compiler. The Haskell Mailing List haskell@haskell.org (http://www.haskell.org/mailinglist.html), May 2000.
S. L. Peyton Jones. Implementing Lazy Functional Languages on Stock Hardware: the Spineless Tagless G-machine. Journal of Functional Programming, 2(2):127–202, April 1992.
S. L. Peyton Jones and A. L. M. Santos. A Transformation-based Optimiser for Haskell. Science of Computer Programming, 32(1-3):3–47, 1998.
M. Tullsen. Compiling Haskell to Java. 690 Project, Yale University, September 1997.
A. Vernet. The Jaskell Project. A Diploma Project, Swiss Federal Institute of Technology, February 1998.
D. Wakeling. Compiling Lazy Functional Programs for the Java Virtual Machine. Journal of Functional Programming, 9(6):579–603, November 1999.
M. Wand. Correctness of Procedure Representations in Higher-Order Assembly Language. In S. Brookes, editor, Proceedings Mathematical Foundations of Programming Semantics ’91, volume 598 of Lecture Notes in Computer Science, pages 294–311. Springer Verlag, 1992.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Choi, K., Lim, Hi., Han, T. (2001). Compiling Lazy Functional Programs Based on the Spineless Tagless G-machine for the Java Virtual Machine. In: Kuchen, H., Ueda, K. (eds) Functional and Logic Programming. FLOPS 2001. Lecture Notes in Computer Science, vol 2024. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44716-4_6
Download citation
DOI: https://doi.org/10.1007/3-540-44716-4_6
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-41739-2
Online ISBN: 978-3-540-44716-0
eBook Packages: Springer Book Archive