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.
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- R. Hinze and A. Löh. "Scrap Your Boilerplate" Revolutions. In Mathematics of Program Construction, volume 4014, pages 180--208. Springer, 2006. Google ScholarDigital Library
- O. Kiselyov. Typed tagless final interpreters. In Lecture Notes of the Spring School on Generic and Indexed Programming (to appear). 2010. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- W. Swierstra. Data types à la carte. Journal of Functional Programming, 18 (4): 423--436, 2008. Google ScholarDigital Library
Index Terms
- A generic abstract syntax model for embedded languages
Recommendations
A generic abstract syntax model for embedded languages
ICFP '12Representing 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. ...
Incremental concrete syntax for embedded languages
SAC '11: Proceedings of the 2011 ACM Symposium on Applied ComputingEmbedded domain-specific languages (EDSLs) are known to improve the productivity of developers. However, for many domains no DSL implementation is available. Two important reasons are: First, the effort to implement embedded DSLs that provide the domain'...
Type-level web APIs with Servant: an exercise in domain-specific generic programming
WGP 2015: Proceedings of the 11th ACM SIGPLAN Workshop on Generic ProgrammingWe describe the design and motivation for Servant, an extensible, type-level DSL for describing Web APIs. Servant APIs are Haskell types. An API type can be interpreted in several different ways: as a server that processes requests, interprets them and ...
Comments