skip to main content
10.1145/2364527.2364573acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

A generic abstract syntax model for embedded languages

Published:09 September 2012Publication History

ABSTRACT

Representing a syntax tree using a data type often involves having many similar-looking constructors. Functions operating on such types often end up having many similar-looking cases. Different languages often make use of similar-looking constructions. We propose a generic model of abstract syntax trees capable of representing a wide range of typed languages. Syntactic constructs can be composed in a modular fashion enabling reuse of abstract syntax and syntactic processing within and across languages. Building on previous methods of encoding extensible data types in Haskell, our model is a pragmatic solution to Wadler's "expression problem". Its practicality has been confirmed by its use in the implementation of the embedded language Feldspar.

References

  1. M. D. Adams. Scrap your zippers: a generic zipper for heterogeneous types. In Proceedings of the 6th ACM SIGPLAN workshop on Generic programming, WGP '10, pages 13--24. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Axelsson and M. Sheeran. Feldspar: Application and implementation. In Lecture Notes of the Central European Functional Programming School, volume 7241 of LNCS. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. E. Axelsson, K. Claessen, G. Dévai, Z. Horváth, K. Keijzer, B. Lyckegård, A. Persson, M. Sheeran, J. Svenningsson, and A. Vajda. Feldspar: A domain specific language for digital signal processing algorithms. In 8th ACM/IEEE International Conference on Formal Methods and Models for Codesign (MEMOCODE 2010), pages 169--178. IEEE Computer Society, 2010.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. P. Bahr and T. Hvitved. Compositional data types. In Proceedings of the seventh ACM SIGPLAN workshop on Generic programming, WGP '11, pages 83--94. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. P. Bjesse, K. Claessen, M. Sheeran, and S. Singh. Lava: Hardware Design in Haskell. In ICFP '98: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, pages 174--184. ACM, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. D. Broman and J. G. Siek. Modelyze: a gradually typed host language for embedding equation-based modeling languages. Technical Report UCB/EECS-2012--173, EECS Department, University of California, Berkeley, Jun 2012.Google ScholarGoogle Scholar
  7. J. Carette, O. Kiselyov, and C.-c. Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. Journal of Functional Programming, 19 (05): 509--543, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. K. Claessen, M. Sheeran, and B. J. Svensson. Expressive array constructs in an embedded GPU kernel programming language. In Proceedings of the 7th workshop on Declarative aspects and applications of multicore programming, DAMP '12, pages 21--30. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. Hinze and A. Löh. "Scrap Your Boilerplate" Revolutions. In Mathematics of Program Construction, volume 4014, pages 180--208. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. O. Kiselyov. Typed tagless final interpreters. In Lecture Notes of the Spring School on Generic and Indexed Programming (to appear). 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Lämmel and S. P. Jones. Scrap your boilerplate: a practical design pattern for generic programming. In Proceedings of the 2003 ACM SIGPLAN international workshop on Types in languages design and implementation, TLDI '03, pages 26--37. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. Lämmel and S. P. Jones. Scrap more boilerplate: reflection, zips, and generalised casts. In Proceedings of the ninth ACM SIGPLAN international conference on Functional programming, ICFP '04, pages 244--255. ACM, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. R. Lämmel and K. Ostermann. Software extension and integration with type classes. In Proceedings of the 5th international conference on Generative programming and component engineering, GPCE '06, pages 161--170. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. P. Magalhães, A. Dijkstra, J. Jeuring, and A. Löh. A generic deriving mechanism for Haskell. In Proceedings of the third ACM Haskell symposium on Haskell, Haskell '10, pages 37--48. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. N. Mitchell and C. Runciman. Uniform boilerplate and list processing. In Proceedings of the ACM SIGPLAN workshop on Haskell workshop, Haskell '07, pages 49--60. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. A. Persson, E. Axelsson, and J. Svenningsson. Generic monadic constructs for embedded languages. In 23rd International Symposium on Implementation and Application of Functional Languages, IFL 2011, volume 7257 of LNCS, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. Rodriguez, J. Jeuring, P. Jansson, A. Gerdes, O. Kiselyov, and B. C. d. S. Oliveira. Comparing libraries for generic programming in Haskell. In Proceedings of the first ACM SIGPLAN symposium on Haskell, Haskell '08, pages 111--122. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. W. Swierstra. Data types à la carte. Journal of Functional Programming, 18 (4): 423--436, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A generic abstract syntax model for embedded languages

            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
              ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
              September 2012
              392 pages
              ISBN:9781450310543
              DOI:10.1145/2364527
              • cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 47, Issue 9
                ICFP '12
                September 2012
                368 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/2398856
                Issue’s Table of Contents

              Copyright © 2012 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: 9 September 2012

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article

              Acceptance Rates

              ICFP '12 Paper Acceptance Rate32of88submissions,36%Overall Acceptance Rate333of1,064submissions,31%

              Upcoming Conference

              ICFP '24

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader