Compiling Mercury to High-Level C Code
Purchase on Springer.com
$29.95 / €24.95 / £19.95*
* Final gross prices may vary according to local VAT.
Many logic programming implementations compile to C, but they compile to very low-level C, and thus discard many of the advantages of compiling to a high-level language. We describe an alternative approach to compiling logic programs to C, based on continuation passing, that we have used in a new back-end for the Mercury compiler. The new approach compiles to much higher-level C code, which means the compiler back-end and run-time system can be considerably simpler. We present a formal schema for the transformation, and give benchmark results which show that this approach delivers performance that is more than competitive with the fastest previous implementation, with greater simplicity and better portability and interoperability.
The approach we describe can also be used for compiling to other target languages, such as IL (the Microsoft .NET intermediate language).
- H. Boehm and M. Weiser. Garbage collection in an uncooperative environment. Software Practice and Experience, 18:807–820, 1988. CrossRef
- T. M. Breuel. Lexical closures for C++. In Proceedings of the 1988 USENIX C++ Conference, pages 293–304, Denver, Colorado, 1988.
- F. Bueno, D. Cabeza, M. Carro, M. Hermenegildo, P. López-García, and G. Puebla. The Ciao Prolog system. reference manual. Technical Report CLIP3/97.1, School of Computer Science, Technical University of Madrid (UPM), August 1997. Available from http://www.clip.dia...upm.es/.
- L. Byrd. Understanding the control of Prolog programs. Technical Report 151, University of Edinburgh, 1980.
- M. Carlsson. On implementing Prolog in functional programming. New Generation Computing, 2(4):347–359, 1984. CrossRef
- P. Codognet and D. Diaz. wamcc: Compiling Prolog to C. In Proceedings of the Twelfth International Conference on Logic Programming, pages 317–331, Kanagawa, Japan, June 1995.
- T. Conway, F. Henderson, and Z. Somogyi. Code generation for Mercury. In Proceedings of the Twelfth International Conference on Logic Programming, pages 242–256, Portland, Oregon, December 1995.
- T. Dowd, F. Henderson, and P. Ross. Compiling Mercury to the.NET Common Language Runtime. In Proceedings of the First International Workshop on Multi-Language Infrastructure and Interoperability, pages 70–85, Firenze, Italy, September 2001.
- B. Hausman. Turbo Erlang: approaching the speed of C. In E. Tick, editor, Implementations of logic programming systems, pages 119–135. Kluwer, 1994.
- F. Henderson, Z. Somogyi, and T. Conway. Compiling logic programs to C using GNU C as a portable assembler. In Proceedings of the ILPS’ 95 Postconference Workshop on Sequential Implementation Technologies for Logic Programming Languages, Portland, Oregon, December 1995.
- F. Henderson, Z. Somogyi, and T. Conway. Determinism analysis in the Mercury compiler. In Proceedings of the Australian Computer Science Conference, pages 337–346, Melbourne, Australia, January 1996.
- J. F. Nilsson. On the compilation of a domain-based Prolog. In Proceedings of the Ninth IFIP Congress, pages 293–298, Paris, France, 1983.
- J. O'Bagy and R. E. Griswold. A recursive interpreter for the Icon programming language. In Proceedings of the 1987 SIGPLAN Symposium on Interpreters and Interpretive Techniques, pages 138–149, St. Paul, Minnesota, 1987.
- Z. Somogyi, F. Henderson, and T. Conway. The execution algorithm of Mercury, an efficient purely declarative logic programming language. Journal of Logic Programming, 29(1–3):17–64, October–December 1996. CrossRef
- P. Tarau, K. D. Bosschere, and B. Demoen. Partial translation: towards a portable and efficient Prolog implementation technology. Journal of Logic Programming, 29(1–3):65–83, October–December 1996. CrossRef
- A. Taylor. LIPS on a MIPS: results from a Prolog compiler for a RISC. In Proceedings of the Seventh International Conference on Logic Programming, pages 174–185, Jerusalem, Israel, June 1990.
- P. Van Roy and A. Despain. High-performance logic programming with the Aquarius Prolog compiler. IEEE Computer, 25(1):54–68, January 1992.
- J. Weiner and S. Ramakrishnan. A piggy-back compiler for Prolog. In Proceedings of the SIGPLAN’ 88 Conference on Programming Language Design and Implementation, pages 288–296, Atlanta, Georgia, June 1988.
- Compiling Mercury to High-Level C Code
- Book Title
- Compiler Construction
- Book Subtitle
- 11th International Conference, CC 2002 Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2002 Grenoble, France, April 8–12, 2002 Proceedings
- pp 197-212
- Print ISBN
- Online ISBN
- Series Title
- Lecture Notes in Computer Science
- Series Volume
- Series ISSN
- Springer Berlin Heidelberg
- Copyright Holder
- Springer-Verlag Berlin Heidelberg
- Additional Links
- compilation techniques
- programming language implementation
- logic programming
- GNU C
- Industry Sectors
- eBook Packages
To view the rest of this content please follow the download PDF link above.