skip to main content
research-article

A generic abstract syntax model for embedded languages

Published:09 September 2012Publication History
Skip Abstract Section

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

            Full Access

            • Published in

              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
              • 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

              Copyright © 2012 ACM

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 9 September 2012

              Check for updates

              Qualifiers

              • research-article

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!