skip to main content
10.1145/1512762.1512767acmconferencesArticle/Chapter ViewAbstractPublication PageslcsdConference Proceedingsconference-collections
research-article

Proto: a compiler construction toolkit for DSELs

Published:21 October 2007Publication History

ABSTRACT

A Domain-Specific Embedded Language (DSEL) is a miniature language-within-a-language for solving problems in a particular domain. One technique for creating efficient and expressive DSELs in C++ is to use expression templates, but this technique is not for the faint of heart. Such libraries are difficult to write and maintain due to the esoteric nature of template meta-programming, and difficult to use because of the often impenetrable compiler error messages they generate. Existing tools help somewhat, but do not provide the support that language designers have come to expect: something like BNF for defining the language's grammar and associated semantic actions. This paper describes Proto, a C++ library that implements a compiler construction toolkit for embedded languages. The benefits of grammar-based DSELs are shown by contrasting them to other existing approaches to DSEL design. The nature of embedded languages with constrained grammars and their implications for a embedded compiler construction toolkit is briefly explored. Some examples are shown where library interfaces can be made more expressive through the use of grammar-based DSELs.

References

  1. L. A. N. L. Advanced Computing Laboratory. PETE. http://acts.nersc.gov/pete/.Google ScholarGoogle Scholar
  2. L. A. N. L. Advanced Computing Laboratory. POOMA. http://www.nongnu.org/freepooma/.Google ScholarGoogle Scholar
  3. J. de Guzman and H. Kaiser. The Spirit Parser Framework. http://spirit.sourceforge.net.Google ScholarGoogle Scholar
  4. J. de Guzman, D. Marsden, and T. Schwinger. Boost. Fusion. http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html.Google ScholarGoogle Scholar
  5. P. Dimov. Proposed Text for Parallel Task Execution. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2185.html.Google ScholarGoogle Scholar
  6. P. Dimov. Transporting Values and Exceptions between Threads. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2096.html.Google ScholarGoogle Scholar
  7. P. Dimov, D. Gregor, J. Järvi, and G. Powell. A Proposal to Add an Enhanced Binder to the Library Technical Report. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1438.htm.Google ScholarGoogle Scholar
  8. H. Hinnant. future groups. [email protected], July 2007. c++std-lib-19057.Google ScholarGoogle Scholar
  9. J. Järvi and G. Powell. The Boost Lambda Library. http://boost.org/doc/html/lambda.html.Google ScholarGoogle Scholar
  10. J. Järvi, B. Stroustrup, and G. Dos Reis. Decltype (revision 7): proposed wording. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf.Google ScholarGoogle Scholar
  11. J. Järvi, J. Willcock, and A. Lumsdaine. Boost. Enable_if. http://boost.org/libs/utility/enable_if.html.Google ScholarGoogle Scholar
  12. S. C. Johnson. Yacc: Yet another compiler compiler. In UNIX Programmer's Manual, volume 2, pages 353--387. Holt, Rinehart, and Winston, New York, NY, USA, 1979.Google ScholarGoogle Scholar
  13. H. Kaiser and T. Schütt. futures based on boost. threads, 2005. http://boost-consulting.com/vault/index.php? action=downloadfile&filename=futures.zip&directory=Concurrent%20Programming.Google ScholarGoogle Scholar
  14. E. Niebler. Boost. Xpressive. http://boost.org/doc/html/xpressive.html.Google ScholarGoogle Scholar
  15. H. Sutter. Thread API interface tweaks. [email protected], August 2006.Google ScholarGoogle Scholar
  16. T. Veldhuizen. Blitz++: Object Oriented Scientific Computing. http://www.oonumerics.org/blitz/.Google ScholarGoogle Scholar
  17. T. Veldhuizen. Blitz++: The Library That Thinks It Is A Compiler. In SciTools, 1998. http://www.oonumerics.org/blitz/blitztalk.ps.Google ScholarGoogle Scholar
  18. T. L. Veldhuizen. Expression templates. C++ Report, 7(5):26--31, June 1995. Reprinted in C++ Gems, ed. Stanley Lippman.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Vertleyb and P. Holt. Boost.Typeof. http://boost.org/doc/html/typeof.html.Google ScholarGoogle Scholar
  20. M. Werle. Daixtrose, Differentiable Expression Templates. http://daixtrose.sourceforge.net/index.html.Google ScholarGoogle Scholar
  21. A. Williams. Thread Pools and Futures. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2276.html.Google ScholarGoogle Scholar

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
    LCSD '07: Proceedings of the 2007 Symposium on Library-Centric Software Design
    October 2007
    125 pages
    ISBN:9781605580869
    DOI:10.1145/1512762

    Copyright © 2007 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: 21 October 2007

    Permissions

    Request permissions about this article.

    Request Permissions

    Check for updates

    Qualifiers

    • research-article

PDF Format

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader