Skip to main content

Compiling Embedded Languages

  • Conference paper
  • First Online:
Book cover Semantics, Applications, and Implementation of Program Generation (SAIG 2000)

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

Abstract

Functional languages are particularly well-suited to the im- plementation of interpreters for domain-specific embedded languages (DSELs). We describe an implemented technique for producing optimiz- ing compilers for DSELs, based on Kamin’s idea of DSELs for program generation. The technique uses a data type of syntax for basic types, a set of smart constructors that perform rewriting over those types, some code motion transformations, and a back-end code generator. Domain- specific optimization results from chains of rewrites on basic types. New DSELs are defined directly in terms of the basic syntactic types, plus host language functions and tuples. This definition style makes compil- ers easy to write and, in fact, almost identical to the simplest embedded interpreters. We illustrate this technique with a language Pan for the computationally intensive domain of image synthesis and manipulation.

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. Oege de Moor and Ganesh Sittampalam. Generic program transformation. In Proceedings of the third International Summer School on Advanced Functional Programming, Springer Lecture Notes in Computer Science, 1999. http://users.comlab.ox.ac.uk/oege.demoor/papers/braga.ps.gz.

    Google Scholar 

  2. Conal Elliott. A Pan image gallery. http://research.microsoft.com/~conal/pan/Gallery.

  3. Conal Elliott. An embedded modeling language approach to interactive 3D and multimedia animation. IEEE Transactions on Software Engineering, 25(3):291–308, May/June 1999. Special Section: Domain-Specific Languages (DSL). http://research.microsoft.com/~conal/papers/tse-modeled-animation.

    Article  Google Scholar 

  4. Conal Elliott. Functional images, unpublished, March 2000. http://research.microsoft.com/~conal/papers/fip.

  5. Conal Elliott, Sigbjørn Finne, and Oege de Moor. Compiling embedded languages (extended version). Technical report, Microsoft Research, May 2000. http://-research.microsoft.com/scripts/pubs/view.asp?TR ID=MSR-TR-2000-52.

  6. Matteo Frigo. A fast Fourier transform compiler. In Proceedings of the ACM SIGPLAN’99 Conference on Programming Language Design and Implementation, pages 169–180, 1999. http://www.acm.org/pubs/articles/proceedings/pldi/301618/p169-frigo/p169-frigo.pdf.

  7. John Hatcliff, Torben Mogensen, and Peter Thiemann, editors. Partial Evaluation: Practice and Theory, volume 1706. Springer-Verlag, 1999.

    Google Scholar 

  8. Paul Hudak. Modular domain specific languages and tools. In P. Devanbu and J. Poulin,editors, Proceedings: Fifth International Conference on Software Reuse, pages 134–142. IEEE Computer Society Press, 1998.

    Google Scholar 

  9. Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall In-ternational, International Series in Computer Science, June 1993. http://www.dina.kvl.dk/~sestoft/pebook/pebook.html.

  10. Samuel Kamin. Standard ML as a meta-programming language. Technical report, University of Illinois at Urbana-Champaign, September 1996. http://www-sal.cs.uiuc.edu/~kamin/pubs/ml-meta.ps.

    Google Scholar 

  11. Samuel Kamin and David Hyatt. A special-purpose language for picture-drawing. In USENIX, editor, Proceedings of the Conference on Domain-Specific Lan-guages, October 15–17, 1997, Santa Barbara, California, pages 297–310, 1997. http://www-sal.cs.uiuc.edu/~kamin/fpic/doc/fpic-paper.ps.

  12. Peter J. Landin. The next 700 programming languages. Communications of the ACM, 9(3):157–164, March 1966. Originally presented at the Proceedings of the ACM Programming Language and Pragmatics Conference, August 8–12, 1965.

    Article  MATH  Google Scholar 

  13. Daan Leijen and Erik Meijer. Domain specific embedded compilers. In 2nd Conference on Domain-Specific Languages (DSL), Austin TX, USA, October 1999. USENIX. http://www.cs.uu.nl/people/daan/papers/dsec.ps.

  14. Walid Taha and Tim Sheard. MetaML and multi-stage programming with explicit annotations. Journal of Theoretical Computer Science, 2000. To appear. http://www.cs.chalmers.se/~taha/publications/journal/tcs00.ps.

  15. GHC Team. The Glasgow Haskell compiler. http://haskell.org/ghc.

  16. Todd Veldhuizen. Expression templates. C++ Report, 7(5):26–31, June 1995. http://extreme.indiana.edu/~tveldhui/papers/pepm99.ps. Reprinted in C++ Gems, ed. Stanley Lippman.

  17. Todd Veldhuizen. C++ templates as partial evaluation. In Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM’99). ACM Sigplan, 1999. http://extreme.indiana.edu/~tveldhui/papers/pepm99.ps.

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2000 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Elliott, C., Finne, S., de Moor, O. (2000). Compiling Embedded Languages. In: Taha, W. (eds) Semantics, Applications, and Implementation of Program Generation. SAIG 2000. Lecture Notes in Computer Science, vol 1924. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45350-4_5

Download citation

  • DOI: https://doi.org/10.1007/3-540-45350-4_5

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

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

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

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics