Abstract
We present a new approach for building source-to-source transformations that can run on multiple programming languages, based on a new way of representing programs called incremental parametric syntax. We implement this approach in Haskell in our Cubix system, and construct incremental parametric syntaxes for C, Java, JavaScript, Lua, and Python. We demonstrate a whole-program refactoring tool that runs on all of them, along with three smaller transformations that each run on several. Our evaluation shows that (1) once a transformation is written, little work is required to configure it for a new language (2) transformations built this way output readable code which preserve the structure of the original, according to participants in our human study, and (3) our transformations can still handle language corner-cases, as validated on compiler test suites.
Supplemental Material
- Franz Baader and Tobias Nipkow. 1999. Term Rewriting and All That. Cambridge university press. Google Scholar
Digital Library
- Patrick Bahr and Tom Hvitved. 2011. Compositional Data Types. In Proceedings of the Seventh ACM SIGPLAN Workshop on Generic programming, [email protected] 2011, Tokyo, Japan, September 19-21, 2011. 83–94. Google Scholar
Digital Library
- Ira D Baxter, Christopher Pidgeon, and Michael Mehlich. 2004. DMS®: Program Transformations for Practical Scalable Software Evolution. In Proceedings of the 26th International Conference on Software Engineering. IEEE Computer Society, 625–634. Google Scholar
Digital Library
- Denis Bogdanas and Grigore Roşu. 2015. K-Java: A Complete Semantics of Java. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, January 15-17, 2015. 445–456. Google Scholar
Digital Library
- Niklas Broberg. 2015. language-java: Manipulating Java source: abstract syntax, lexer, parser, and pretty-printer. http: //hackage.haskell.org/package/language-java-0.2.8 . (November 2015).Google Scholar
- Fraser Brown, Andres Nötzli, and Dawson Engler. 2016. How to Build Static Checking Systems Using Orders of Magnitude Less Code. In Proceedings of the Twenty-First International Conference on Architectural Support for Programming Languages and Operating Systems. ACM, 143–157. Google Scholar
Digital Library
- David Brumley, Ivan Jager, Thanassis Avgerinos, and Edward J. Schwartz. 2011. BAP: A Binary Analysis Platform. In CAV. Google Scholar
Digital Library
- Martin Churchill, Peter D Mosses, Neil Sculthorpe, and Paolo Torrini. 2015. Reusable Components of Semantic Specifications. In Transactions on Aspect-Oriented Software Development XII. Springer, 132–179.Google Scholar
- Manuel Clavel, Francisco Durán, Steven Eker, Patrick Lincoln, Narciso Martı-Oliet, José Meseguer, and José F Quesada. 2002. Maude: Specification and Programming in Rewriting Logic. Theoretical Computer Science 285, 2 (2002), 187–243. Google Scholar
Digital Library
- James R Cordy. 2006. The TXL Source Transformation Language. Science of Computer Programming 61, 3 (2006), 190–210. Google Scholar
Digital Library
- Bruno C. d. S. Oliveira, Shin-Cheng Mu, and Shu-Hung You. 2015. Modular Reifiable Matching: A List-of-Functors Approach to Two-level Types. In Proceedings of the 8th ACM SIGPLAN Symposium on Haskell, Haskell 2015, Vancouver, BC, Canada, September 3-4, 2015. 82–93. Google Scholar
Digital Library
- Benjamin Delaware, Steven Keuchel, Tom Schrijvers, and Bruno C. d. S. Oliveira. 2013. Modular Monadic Meta-Theory. In ACM SIGPLAN International Conference on Functional Programming, ICFP’13, Boston, MA, USA - September 25 - 27, 2013. 319–330. Google Scholar
Digital Library
- Isil Dillig, Thomas Dillig, and Alex Aiken. 2009. SAIL: Static Analysis Intermediate Language with a Two-level Representation. Stanford University Technical Report (2009).Google Scholar
- Tom Dinkelaker, Michael Eichberg, and Mira Mezini. 2013. Incremental Concrete Syntax for Embedded Languages with Support for Separate Compilation. Science of Computer Programming 78, 6 (2013), 615–632. Google Scholar
Digital Library
- Michael Dory, Allison Parrish, and Brendan Berg. 2012. Introduction to Tornado: Modern Web Applications with Python. O’Reilly Media, Inc. Google Scholar
Digital Library
- Sebastian Erdweg, Tijs van der Storm, Markus Völter, Meinte Boersma, Remi Bosman, William R Cook, Albert Gerritsen, Angelo Hulshout, Steven Kelly, Alex Loh, et al. 2013. The State of the Art in Language Workbenches. In International Conference on Software Language Engineering. Springer, 197–217.Google Scholar
- Python Software Foundation. 2016. CPython Test Suite. Version 3.7.0a0. https://docs.python.org/devguide/runtests.html . (October 2016).Google Scholar
- FSF. 2016. C Language Testsuites: “C-torture”. Revision 240758. http://gcc.gnu.org/onlinedocs/gccint/C-Tests.html . (October 2016).Google Scholar
- Andy Gill. 2009. A Haskell Hosted DSL for Writing Transformation Systems. In Domain-Specific Languages. Springer, 285–309. Google Scholar
Digital Library
- Matthias Grimmer, Chris Seaton, Roland Schatz, Thomas Würthinger, and Hanspeter Mössenböck. 2015. High-performance cross-language interoperability in a multi-language runtime. In Proceedings of the 11th Symposium on Dynamic Languages, DLS 2015, part of SPLASH 2015, Pittsburgh, PA, USA, October 25-30, 2015. 78–90. Google Scholar
Digital Library
- Miguel Grinberg. 2014. Flask Web Development: Developing Web Applications with Python. O’Reilly Media, Inc. Google Scholar
Digital Library
- Jan Heering and Ralf Lämmel. 2004. Generic Software Transformations. In Proceedings of the Software Transformation Systems Workshop.Google Scholar
- Benedikt Huber. 2016. language-c: Analysis and generation of C code. http://hackage.haskell.org/package/language-c . (2016).Google Scholar
- JDK Bug System. 2016. javac crash when local from enclosing context is captured multiple times. https://bugs.openjdk.java. net/browse/JDK-8169345 . (2016).Google Scholar
- Lennart CL Kats and Eelco Visser. 2010. The Spoofax Language Workbench: Rules for Declarative Specification of Languages and IDEs. Vol. 45. ACM.Google Scholar
- Oleg Kiselyov. 2012. Typed Tagless Final Interpreters. In Generic and Indexed Programming. Springer, 130–174. Google Scholar
Digital Library
- Paul Klint, Tijs van der Storm, and Jurgen Vinju. 2009. EASY Meta-programming with Rascal. In International Summer School on Generative and Transformational Techniques in Software Engineering. Springer, 222–289. Google Scholar
Digital Library
- James Koppel, Varot Premtoon, and Armando Solar-Lezama. 2018. One Tool, Many Languages: Language-Parametric Transformation with Incremental Parametric Syntax. CoRR abs/1707.04600 (2018). arXiv: 1707.04600 http://arxiv.org/abs/ 1707.04600 Google Scholar
Digital Library
- James Koppel and Armando Solar-Lezama. 2017. Incremental parametric syntax for multi-language transformation. In Proceedings Companion of the 2017 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity, SPLASH 2017, Vancouver, BC, Canada, October 23 - 27, 2017. 53–54. Google Scholar
Digital Library
- Ralf Lämmel. 2002. Towards Generic Refactoring. In Proceedings of the 2002 ACM SIGPLAN workshop on Rule-based programming. ACM, 15–28. Google Scholar
Digital Library
- Ralf Lämmel and Simon Peyton Jones. 2003. Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming. Vol. 38. ACM.Google Scholar
- Ralf Lämmel, Eelco Visser, and Joost Visser. 2003. Strategic Programming Meets Adaptive Programming. In Proceedings of the 2Nd International Conference on Aspect-oriented Software Development (AOSD ’03). ACM, New York, NY, USA, 168–177. Google Scholar
Digital Library
- Ralf Lämmel and Joost Visser. 2002. Typed Combinators for Generic Traversal. In International Symposium on Practical Aspects of Declarative Languages. Springer, 137–154. Google Scholar
Digital Library
- Ralf Lämmel and Joost Visser. 2003. A Strafunski Application Letter. In International Symposium on Practical Aspects of Declarative Languages. Springer, 357–375. Google Scholar
Digital Library
- Chris Lattner and Vikram S. Adve. 2004. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In 2nd IEEE / ACM International Symposium on Code Generation and Optimization (CGO 2004), 20-24 March 2004, San Jose, CA, USA. 75–88. Google Scholar
Digital Library
- Sheng Liang, Paul Hudak, and Mark Jones. 1995. Monad Transformers and Modular Interpreters. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, 333–343. Google Scholar
Digital Library
- Tim Lindholm, Frank Yellin, Gilad Bracha, and Alex Buckley. 2014. The Java Virtual Machine Specification: Java SE 8 Edition. Pearson Education. Google Scholar
Digital Library
- Sam Madden. 2017. 6.830 Lab 1: SimpleDB. (2017). http://db.csail.mit.edu/6.830/assignments/lab1.htmlGoogle Scholar
- Leon Moonen. 2001. Generating Robust Parsers using Island Grammars. In Reverse Engineering, 2001. Proceedings. Eighth Working Conference on. IEEE, 13–22. Google Scholar
Digital Library
- Peter D. Mosses. 2004. Modular Structural Operational Semantics. J. Log. Algebr. Program. 60-61 (2004), 195–228.Google Scholar
- Daejun Park, Andrei Stefănescu, and Grigore Roşu. 2015. KJS: A Complete Formal Semantics of JavaScript. In ACM SIGPLAN Notices, Vol. 50. ACM, 346–356. Google Scholar
Digital Library
- Bernard James Pope. 2016. language-python: Parsing and pretty printing of Python code. http://hackage.haskell.org/ package/language-python-0.5.4 . (July 2016).Google Scholar
- PUC-Rio. 2016. Lua: Test suites. Version 5.3.3. https://www.lua.org/tests/ . (2016).Google Scholar
- Semantic Designs, Inc. 2005. Test Coverage tools. http://www.semanticdesigns.com/Products/TestCoverage/ . (2005).Google Scholar
- Tim Sheard and Simon Peyton Jones. 2002. Template Meta-Programming for Haskell. In Proceedings of the 2002 ACM SIGPLAN Workshop on Haskell. ACM, 1–16. Google Scholar
Digital Library
- Wouter Swierstra. 2008. Data Types à la Carte. Journal of Functional Programming 18, 04 (2008), 423–436. Google Scholar
Digital Library
- ECMA TC39. 2014. Test262: ECMAScript Language Conformance Test Suite. Version 5.1. http://test262.ecmascript.org . (2014).Google Scholar
- Danny van Bruggen. 2016. JavaParser: Process Java code programmatically. (2016). http://javaparser.orgGoogle Scholar
- Mark van de Brand, Jan Heering, Paul Klint, Ralf Lämmel, and Christian Verhoef. 2003. Language-Parametric Program Restructuring. (2003). http://www.cs.vu.nl/lppr/abstract/abstract.htmlGoogle Scholar
- Jilles Van Gurp, Jan Bosch, and Mikael Svahnberg. 2001. On the Notion of Variability in Software Product Lines. In Software Architecture, 2001. Proceedings. Working IEEE/IFIP Conference on. IEEE, 45–54. Google Scholar
Digital Library
- Markus Voelter and Vaclav Pech. 2012. Language Modularity with the MPS Language Workbench. In 2012 34th International Conference on Software Engineering (ICSE). IEEE, 1449–1450. Google Scholar
Digital Library
- Philip Wadler. 1987. Views: A Way for Pattern Matching to Cohabit with Data Abstraction. In Proceedings of the 14th ACM SIGACT-SIGPLAN symposium on Principles of programming languages. ACM, 307–313. Google Scholar
Digital Library
- Philip Wadler. 1998. The Expression Problem. Java-genericity mailing list (1998).Google Scholar
- Stefan Wellek. 2010. Testing Statistical Hypotheses of Equivalence and Noninferiority. CRC Press.Google Scholar
- Alexey Rodriguez Yakushev, Stefan Holdermans, Andres Löh, and Johan Jeuring. 2009. Generic Programming with Fixed Points for Mutually Recursive Datatypes. In Proceeding of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP 2009, Edinburgh, Scotland, UK, August 31 - September 2, 2009. 233–244. Google Scholar
Digital Library
- Haoyuan Zhang, Zewei Chu, Bruno C. d. S. Oliveira, and Tijs van der Storm. 2015. Scrap Your Boilerplate with Object Algebras. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2015, part of SPLASH 2015, Pittsburgh, PA, USA, October 25-30, 2015. 127–146. Google Scholar
Digital Library
- Alan Zimmerman. 2016. language-javascript: Parser for JavaScript. http://hackage.haskell.org/package/ language-javascript-0.6.0.9 . (November 2016).Google Scholar
Index Terms
One tool, many languages: language-parametric transformation with incremental parametric syntax
Recommendations
Incremental parametric syntax for multi-language transformation
SPLASH Companion 2017: Proceedings Companion of the 2017 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for HumanityWe present a new approach for building source-to-source transformations that can run on multiple programming languages, based on a new way of representing programs called incremental parametric syntax. We implement this approach in our Cubix system, and ...
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'...
Incremental concrete syntax for embedded languages with support for separate compilation
Embedded domain-specific languages (EDSLs) are known to improve the productivity of developers. However, for many domains no DSL implementation is available and two important reasons for this are: First, the effort to implement EDSLs that provide the ...






Comments