Skip to main content

Compiling Embedded Programs to Byte Code

  • Conference paper
  • First Online:
Book cover Practical Aspects of Declarative Languages (PADL 2002)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2257))

Included in the following conference series:

  • 277 Accesses

Abstract

Functional languages have proven substantially useful for hosting embedded domain-specific languages. They provide an infrastructure rich enough to define both a convenient syntax for the embedded language, a type system for embedded programs, and an evaluation mechanism for embedded programs. However, all existing host languages either interpret embedded programs instead of compiling them or require an expensive pre-compilation phase. In this article we close this gap in an implementation of the functional language OCaml: We provide a library of OCamlb yte-code combinators that is reminiscent of quasi-quotation in Lisp and of ’C and that enables just-in-time compilation of embedded programs. We illustrate these byte-code combinators on a prototypical domain-specific language.

Funded by the Danish National Research Foundation.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Vincent Balat and Olivier Danvy. Strong normalization by type-directed partial evaluation and run-time code generation. In Xavier Leroy and Atsushi Ohori, editors, Proceedings of the Second International Workshop on Types in Compilation, number 1473 in Lecture Notes in Computer Science, pages 240–252, Kyoto, Japan, March 1998.

    Google Scholar 

  2. Thomas Ball, editor. Proceedings of the Second USENIX Conference on Domain-Specific Languages, Austin, Texas, October 1999.

    Google Scholar 

  3. Alan Bawden. Quasiquotation in Lisp. In Olivier Danvy, editor, Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, number NS-99-1 in BRICS Note Series, pages 4–12, San Antonio, Texas, January 1999.

    Google Scholar 

  4. Charles Consel and François Noël. A general approach for run-time specialization and its application to C. In Steele [34], pages 145–156.

    Google Scholar 

  5. Olivier Danvy. Type-directed partial evaluation. In John Hatcliff, Torben Æ. Mogensen, and Peter Thiemann, editors, Partial Evaluation-Practice and Theory; Proceedings of the 1998 DIKU Summer School, number 1706 in Lecture Notes in Computer Science, pages 367–411, Copenhagen, Denmark, July 1998. Springer-Verlag.

    Google Scholar 

  6. Olivier Danvy. Programming techniques for partial evaluation. In Friedrich L. Bauer and Ralf Steinbrüggen, editors, Foundations of Secure Computation, NATO Science series, pages 287–318. IOS Press Ohmsha, 2000.

    Google Scholar 

  7. Olivier Danvy and Lasse R. Nielsen. Defunctionalization at work. In Harald Søndergaard, editor, Proceedings of the Third International Conference on Principles and Practice of Declarative Programming, Firenze, Italy, September 2001. ACM Press. To appear.

    Google Scholar 

  8. Rowan Davies. A temporal-logic approach to binding-time analysis. In Edmund M. Clarke, editor, Proceedings of the Eleventh Annual IEEE Symposium on Logic in Computer Science, pages 184–195, New Brunswick, New Jersey, July 1996. IEEE Computer Society Press.

    Google Scholar 

  9. Rowan Davies and Frank Pfenning. A modalan alysis of staged computation. In Steele [34], pages 258–283.

    Google Scholar 

  10. Rowan Davies and Frank Pfenning. A modalan alysis of staged computation. Technical report CMU-CS-99-153, Schoolof Computer Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, 1999. To appear in JACM.

    Google Scholar 

  11. Premkumar Devanbu and Jeff Poulin, editors. Proceedings of the Fifth International Conference on Software Reuse, Victoria, British Columbia, June 1998. IEEE Computer Society Press.

    Google Scholar 

  12. Conal Elliott, Sigbjorn Finne, and Oege de Moor. Compiling embedded languages. In Walid Taha, editor, Proceedings of the International Workshop on Semantics, Applications, and Implementation of Program Generation, number 1924 in Lecture Notes in Computer Science, pages 9–27, Montr’eal, Canada, September 2000.

    Chapter  Google Scholar 

  13. Dawson R. Engler, Wilson C. Hsieh, and M. Frans Kaashoek. ’C: A language for high-level, efficient, and machine-independent dynamic code generation. In Steele [34], pages 131–144.

    Google Scholar 

  14. Joseph H. Fasel, Paul Hudak, Simon Peyton Jones, and Philip Wadler. Haskell special issue. SIGPLAN Notices, 27(5), May 1992.

    Google Scholar 

  15. Sigbjorn Finne, Daan Leijen, Erik Meijer, and Simon Peyton Jones. Calling hell from heaven and heaven from hell. In Peter Lee, editor, Proceedings of the 1999 ACM SIGPLAN International Conference on Functional Programming, pages 114–125, Paris, France, September 1999. ACM Press.

    Google Scholar 

  16. Yoshihiko Futamura. Partialev aluation of computation process-an approach to a compiler-compiler. Higher-Order and Symbolic Computation, 12(4):381–391, 1999. Reprinted from Systems, Computers, Controls 2(5), 1971.

    Article  MATH  Google Scholar 

  17. Robert Harper. Proof-directed debugging. Journal of Functional Programming, 9(4):463–469, July 1999.

    Article  MATH  MathSciNet  Google Scholar 

  18. Jason Hickey. Nuprl-light: An implementation framework for higher-order logics. In William McCune, editor, 14th International Conference on Automated Deduction, number 1249 in Lecture Notes in Artificial Intelligence, pages 395–399. Springer-Verlag, 1997.

    Google Scholar 

  19. Jason J. Hickey and Aleksey Nogin. Fast tactic-based theorem proving. In J. Harrison and M. Aagaard, editors, Theorem Proving in Higher Order Logics: 13th International Conference, TPHOLs 2000, volume 1869 of Lecture Notes in Computer cience, pages 252–266. Springer-Verlag, 2000.

    Google Scholar 

  20. Paul Hudak. Modular domain specific languages and tools. In Devanbu and Poulin [11], pages 134–142.

    Google Scholar 

  21. Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice HallIn ternationalSe ries in Computer Science. Prentice-Hall, 1993. Available online at http://www.dina.kvl.dk/~sestoft/pebook/pebook.html.

  22. Simon Peyton Jones, Erik Meijer, and Daan Leijen. Scripting COM components in Haskell. In Devanbu and Poulin [11], pages 224–233.

    Google Scholar 

  23. Peter J. Landin. The next 700 programming languages. Communications of the ACM, 9(3):157–166, 1966.

    Article  MATH  Google Scholar 

  24. Daan Leijen and Erik Meijer. Domain specific embedded compilers. In Thomas Ball, editor, Proceedings of the 2nd USENIX Conference on Domain-Specific Languages, pages 109–122, 1999.

    Google Scholar 

  25. Mark Leone and Peter Lee. Lightweight run-time code generation. In Peter Sestoft and Harald Søndergaard, editors, Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, Technical Report 94/9, University of Melbourne, Australia, pages 97–106, Orlando, Florida, June 1994.

    Google Scholar 

  26. Mark Leone and Peter Lee. Optimizing ML with run-time code generation. In Proceedings of the ACM SIGPLAN’96 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 31, No 5, pages 137–148. ACM Press, May 1996.

    Google Scholar 

  27. Xavier Leroy. The Objective Caml system, release 3.01. INRIA, Rocquencourt, France, March 2001.

    Google Scholar 

  28. Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). The MIT Press, 1997.

    Google Scholar 

  29. Lockwood Morris. The next 700 formall anguage descriptions. Lisp and Symbolic Computation, 6(3/4):249–258, 1993.

    Article  Google Scholar 

  30. Frank Pfenning and Conal Elliott. Higher-order abstract syntax. In Mayer D. Schwartz, editor, Proceedings of the ACM SIGPLAN’88 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 23, No 7, pages 199–208, Atlanta, Georgia, June 1988. ACM Press.

    Google Scholar 

  31. Chris Ramming, editor. Proceedings of the First USENIX Conference on DomainSpecific Languages, Santa Barbara, California, October 1997.

    Google Scholar 

  32. Morten Rhiger. Higher-Order Program Generation. PhD thesis, BRICS PhD School, University of Aarhus, Aarhus, Denmark, July 2001.

    Google Scholar 

  33. Michael Sperber and Peter Thiemann. Two for the price of one: composing partial evaluation and compilation. In Ron K. Cytron, editor, Proceedings of the ACM SIGPLAN’97 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 32, No 5, pages 215–225, Las Vegas, Nevada, June 1997. ACM Press.

    Google Scholar 

  34. Guy L. Steele, editor. Proceedings of the Twenty-Third Annual ACM Symposium on Principles of Programming Languages, St. Petersburg Beach, Florida, January 1996. ACM Press.

    Google Scholar 

  35. Peter Thiemann. Combinators for program generation. Journal of Functional Programming, 9(5):483–525, 1999.

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2002 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Rhiger, M. (2002). Compiling Embedded Programs to Byte Code. In: Krishnamurthi, S., Ramakrishnan, C.R. (eds) Practical Aspects of Declarative Languages. PADL 2002. Lecture Notes in Computer Science, vol 2257. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45587-6_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-45587-6_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-43092-6

  • Online ISBN: 978-3-540-45587-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics