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 2012 Publication 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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[9]
R. Hinze and A. Löh. "Scrap Your Boilerplate" Revolutions. In Mathematics of Program Construction, volume 4014, pages 180--208. Springer, 2006.
[10]
O. Kiselyov. Typed tagless final interpreters. In Lecture Notes of the Spring School on Generic and Indexed Programming (to appear). 2010.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[18]
W. Swierstra. Data types à la carte. Journal of Functional Programming, 18 (4): 423--436, 2008.

Cited By

View all
  • (2022)Embedded pattern matchingProceedings of the 15th ACM SIGPLAN International Haskell Symposium10.1145/3546189.3549917(123-136)Online publication date: 6-Sep-2022
  • (2018)Gradually typed symbolic expressionsProceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation - PEPM '1810.1145/3175493.3162068(15-29)Online publication date: 2018
  • (2017)Gradually typed symbolic expressionsProceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3162068(15-29)Online publication date: 25-Dec-2017
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 09 September 2012

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. embedded domain-specific languages
  2. generic programming
  3. the expression problem

Qualifiers

  • Research-article

Conference

ICFP'12
Sponsor:

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)9
  • Downloads (Last 6 weeks)0
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2022)Embedded pattern matchingProceedings of the 15th ACM SIGPLAN International Haskell Symposium10.1145/3546189.3549917(123-136)Online publication date: 6-Sep-2022
  • (2018)Gradually typed symbolic expressionsProceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation - PEPM '1810.1145/3175493.3162068(15-29)Online publication date: 2018
  • (2017)Gradually typed symbolic expressionsProceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/3162068(15-29)Online publication date: 25-Dec-2017
  • (2015)Modular reifiable matching: a list-of-functors approach to two-level typesACM SIGPLAN Notices10.1145/2887747.280431550:12(82-93)Online publication date: 30-Aug-2015
  • (2015)Converting data-parallelism to task-parallelism by rewrites: purely functional programs across multiple GPUsProceedings of the 4th ACM SIGPLAN Workshop on Functional High-Performance Computing10.1145/2808091.2808093(12-22)Online publication date: 30-Aug-2015
  • (2015)Modular reifiable matching: a list-of-functors approach to two-level typesProceedings of the 2015 ACM SIGPLAN Symposium on Haskell10.1145/2804302.2804315(82-93)Online publication date: 30-Aug-2015
  • (2015)How functional programming matteredNational Science Review10.1093/nsr/nwv0422:3(349-370)Online publication date: 13-Jul-2015
  • (2013)Simple and compositional reification of monadic embedded languagesACM SIGPLAN Notices10.1145/2544174.250061148:9(299-304)Online publication date: 25-Sep-2013
  • (2013)Optimising purely functional GPU programsACM SIGPLAN Notices10.1145/2544174.250059548:9(49-60)Online publication date: 25-Sep-2013
  • (2013)Simple and compositional reification of monadic embedded languagesProceedings of the 18th ACM SIGPLAN international conference on Functional programming10.1145/2500365.2500611(299-304)Online publication date: 25-Sep-2013
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media