skip to main content
10.1145/1085114.1085122acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

MinCaml: a simple and efficient compiler for a minimal functional language

Published:25 September 2005Publication History

ABSTRACT

We present a simple compiler, consisting of only 2000 lines of ML, for a strict, impure, monomorphic, and higher-order functional language. Although this language is minimal, our compiler generates as fast code as standard compilers like Objective Caml and GCC for several applications including ray tracing, written in the opti-mal style of each language implementation. Our primary purpose is education at undergraduate level to convince students--as well as average programmers--that functional languages are simple and efficient.

References

  1. Comp.lang.ml FAQ. http://www.faqs.org/faqs/meta-lang-faq/.Google ScholarGoogle Scholar
  2. The computer language shootout benchmarks. http://shootout.alioth.debian.org/.Google ScholarGoogle Scholar
  3. ICFP programming contest. http://icfpcontest.org/.Google ScholarGoogle Scholar
  4. MLton Standard ML compiler. http://mlton.org/.Google ScholarGoogle Scholar
  5. A. W. Appel. Compiling with Continuations. Cambridge University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. A. W. Appel. Modern Compiler Implementation in ML. Cambridge University Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. L. Birkedal, M. Tofte, and M. Vejlstrup. From region inference to von neumann machines via region representation inference. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 171--183, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. G. J. Chaitin. Register allocation & spilling via graph coloring. In Proceedings of the 1982 SIGPLAN Symposium on Compiler Construction, pages 98--101, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. Dijkstra and S. D. Swierstra. Essential Haskell compiler. http://catamaran.labs.cs.uu.nl/twiki/st/bin/view/Ehc/WebHome.Google ScholarGoogle Scholar
  10. M. Feeley. The 90 minute Scheme to C compiler. http://www.iro.umontreal.ca/~boucherd/mslug/meetings/20041020/.Google ScholarGoogle Scholar
  11. C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proceedings of the ACM SIGPLAN '93 Conference on Programming Language Design and Implementation, pages 237--247, 1993. In ACM SIGPLAN Notices, 28(6), June 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. B. Ford. Packrat parsing: Simple, powerful, lazy, linear time. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming, pages 36--47, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J. Garrigue. Programming with polymorphic variants. In Proceedings of the 1998 ACM SIGPLAN Workshop on ML, 1998.Google ScholarGoogle Scholar
  14. E. Hilsdale, J. M. Ashley, R. K. Dybvig, and D. P. Friedman. Compiler construction using Scheme. In Functional Programming Languages in Education, volume 1022 of Lecture Notes in Computer Science, pages 251--267. Springer-Verlag, 1995. Google ScholarGoogle Scholar
  15. T. Jim. What are principal typings and what are they good for? In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 42--53, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. L. Lawall and O. Danvy. Continuation-based partial evaluation. In Pro-ceedings of the 1994 ACM Conference on LISP and Functional Programming, volume VII of ACM SIGPLAN Lisp Pointers, pages 227--238, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Y. Minamide, G. Morrisett, and R. Harper. Typed closure conversion. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 271--283, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Muchnick. Advanced Compiler Design and Implementation. Morgan Kaufmann, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Ohori. A polymorphic record calculus and its compilation. ACM Transactions on Programming Languages and Systems, 17(6):844-895, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. S. Peyton Jones and S. Marlow. Secrets of the Glasgow Haskell Compiler inliner. Journal of Functional Programming, 12(4):393--434, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. M. Poletto and V. Sarkar. Linear scan register allocation. ACM Transactions on Programming Languages and Systems, 21(5):895--913, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. D. Remy. Type inference for records in a natural extension of ML. In C. A. Gunter and J. C. Mitchell, editors, Theoretical Aspects of Object-Oriented Programming: Types, Semantics, and Language Design. MIT Press, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. D. Sarkar, O. Waddell, and R. K. Dybvig. A nanopass infrastructure for compiler education. In Proceedings of the Ninth ACM SIGPLAN International Conference on Functional Programming, pages 201 -- 212, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. P. Wadler. Why no one uses functional languages. SIGPLAN Notices, 33(8):23--27, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. MinCaml: a simple and efficient compiler for a minimal functional language

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        FDPE '05: Proceedings of the 2005 workshop on Functional and declarative programming in education
        September 2005
        53 pages
        ISBN:1595930671
        DOI:10.1145/1085114

        Copyright © 2005 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 25 September 2005

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • Article

        Upcoming Conference

        ICFP '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader