Typed Multi-Language Strategy Combinators

Author James Koppel



PDF
Thumbnail PDF

File

OASIcs.EVCS.2023.16.pdf
  • Filesize: 0.76 MB
  • 9 pages

Document Identifiers

Author Details

James Koppel
  • MIT, Cambridge, MA, US

Cite AsGet BibTex

James Koppel. Typed Multi-Language Strategy Combinators. In Eelco Visser Commemorative Symposium (EVCS 2023). Open Access Series in Informatics (OASIcs), Volume 109, pp. 16:1-16:9, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)
https://doi.org/10.4230/OASIcs.EVCS.2023.16

Abstract

Strategy combinators (also called strategic programming) are a technique for modular program transformation construction invented by Bas Luttik and Eelco Visser, best known for their instantiation in the Stratego language. Traditional implementations are dynamically typed, and struggle to represent transformations that can be usefully applied to some types, but not all. We present the design of our strategy-combinator library compstrat, a library for type-safe strategy combinators which run on Patrick Bahr’s compositional datatypes. We show how strategy combinators and compositional datatypes fuse elegantly, allowing the creation of type-preserving program transformations which operate only on datatypes satisfying certain properties. With this technique, it becomes possible to compactly define program transformations that operate on multiple programming languages. compstrat is part of the Cubix framework and has been used to build four program transformations, each of which operates on at least three languages.

Subject Classification

ACM Subject Classification
  • Software and its engineering → Translator writing systems and compiler generators
  • Software and its engineering → General programming languages
Keywords
  • program transformation
  • strategic programming

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. Patrick Bahr and Tom Hvitved. Compositional Data Types. In Proceedings of the Seventh ACM SIGPLAN Workshop on Generic programming, WGP@ICFP 2011, Tokyo, Japan, September 19-21, 2011, pages 83-94, 2011. Google Scholar
  2. Andy Gill. A Haskell Hosted DSL for Writing Transformation Systems. In Domain-Specific Languages, pages 285-309. Springer, 2009. Google Scholar
  3. James Koppel. One CFG-Generator to Rule Them All. https://www.jameskoppel.com/files/papers/cubix_cfg.pdf. Accessed: 2022-10-28.
  4. James Koppel, Varot Premtoon, and Armando Solar-Lezama. One Tool, Many Languages: Language-Parametric Transformation with Incremental Parametric Syntax. Proceedings of the ACM on Programming Languages, 2(OOPSLA):122, 2018. Google Scholar
  5. Ralf Lämmel and Simon Peyton Jones. Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming. ACM SIGPLAN Notices, 38(3):26-37, 2003. Google Scholar
  6. Ralf Lämmel, Eelco Visser, and Joost Visser. The Essence of Strategic Programming. https://www.researchgate.net/publication/277289331_The_Essence_of_Strategic_Programming, 2002.
  7. Ralf Lämmel and Joost Visser. A Strafunski Application Letter. In International Symposium on Practical Aspects of Declarative Languages, pages 357-375. Springer, 2003. Google Scholar
  8. Bas Luttik and Eelco Visser. Specification of Rewriting Strategies. In Proceedings of the 2nd International Workshop on the Theory and Practice of Algebraic Specifications, pages 1-16, 1997. Google Scholar
  9. Varot Premtoon, James Koppel, and Armando Solar-Lezama. Semantic Code Search via Equational Reasoning. In Proceedings of the 41st ACM SIGPLAN International Conference on Programming Language Design and Implementation, PLDI 2020, London, UK, June 15-20, 2020, pages 1066-1082, 2020. URL: https://doi.org/10.1145/3385412.3386001.
  10. Deling Ren and Martin Erwig. A Generic Recursion Toolbox for Haskell, Or: Scrap Your Boilerplate Systematically. In Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, pages 13-24, 2006. Google Scholar
  11. Neil Sculthorpe, Nicolas Frisby, and Andy Gill. The Kansas University Rewrite Engine: A Haskell-Embedded Strategic Programming Language with Custom Closed Universes. Journal of Functional Programming, 24(4):434-473, 2014. Google Scholar
  12. Wouter Swierstra. Data Types à la Carte. Journal of Functional Programming, 18(04):423-436, 2008. Google Scholar
  13. Patrick Thomson, Rob Rix, Nicolas Wu, and Tom Schrijvers. Fusing Industry and Academia at GitHub (experience report). arXiv preprint, 2022. URL: http://arxiv.org/abs/2206.09206.
  14. Arie van Deursen and Joost Visser. Building Program Understanding Tools Using Visitor Combinators. In Proceedings 10th International Workshop on Program Comprehension, pages 137-146. IEEE, 2002. Google Scholar
  15. Eelco Visser. Stratego: A Language for Program Transformation Based on Rewriting Strategies: System Description of Stratego 0.5. In International Conference on Rewriting Techniques and Applications, pages 357-361. Springer, 2001. Google Scholar
  16. Eelco Visser, Zine-el-Abidine Benaissa, and Andrew Tolmach. Building Program Optimizers with Rewriting Strategies. ACM Sigplan Notices, 34(1):13-26, 1998. Google Scholar
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail