skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

One tool, many languages: language-parametric transformation with incremental parametric syntax

Published:24 October 2018Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

a122-koppel.webm

References

  1. Franz Baader and Tobias Nipkow. 1999. Term Rewriting and All That. Cambridge university press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle Scholar
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. David Brumley, Ivan Jager, Thanassis Avgerinos, and Edward J. Schwartz. 2011. BAP: A Binary Analysis Platform. In CAV. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle Scholar
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. James R Cordy. 2006. The TXL Source Transformation Language. Science of Computer Programming 61, 3 (2006), 190–210. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. Isil Dillig, Thomas Dillig, and Alex Aiken. 2009. SAIL: Static Analysis Intermediate Language with a Two-level Representation. Stanford University Technical Report (2009).Google ScholarGoogle Scholar
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. Michael Dory, Allison Parrish, and Brendan Berg. 2012. Introduction to Tornado: Modern Web Applications with Python. O’Reilly Media, Inc. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle Scholar
  17. Python Software Foundation. 2016. CPython Test Suite. Version 3.7.0a0. https://docs.python.org/devguide/runtests.html . (October 2016).Google ScholarGoogle Scholar
  18. FSF. 2016. C Language Testsuites: “C-torture”. Revision 240758. http://gcc.gnu.org/onlinedocs/gccint/C-Tests.html . (October 2016).Google ScholarGoogle Scholar
  19. Andy Gill. 2009. A Haskell Hosted DSL for Writing Transformation Systems. In Domain-Specific Languages. Springer, 285–309. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. Miguel Grinberg. 2014. Flask Web Development: Developing Web Applications with Python. O’Reilly Media, Inc. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Jan Heering and Ralf Lämmel. 2004. Generic Software Transformations. In Proceedings of the Software Transformation Systems Workshop.Google ScholarGoogle Scholar
  23. Benedikt Huber. 2016. language-c: Analysis and generation of C code. http://hackage.haskell.org/package/language-c . (2016).Google ScholarGoogle Scholar
  24. 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 ScholarGoogle Scholar
  25. Lennart CL Kats and Eelco Visser. 2010. The Spoofax Language Workbench: Rules for Declarative Specification of Languages and IDEs. Vol. 45. ACM.Google ScholarGoogle Scholar
  26. Oleg Kiselyov. 2012. Typed Tagless Final Interpreters. In Generic and Indexed Programming. Springer, 130–174. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. Ralf Lämmel. 2002. Towards Generic Refactoring. In Proceedings of the 2002 ACM SIGPLAN workshop on Rule-based programming. ACM, 15–28. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Ralf Lämmel and Simon Peyton Jones. 2003. Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming. Vol. 38. ACM.Google ScholarGoogle Scholar
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. Ralf Lämmel and Joost Visser. 2003. A Strafunski Application Letter. In International Symposium on Practical Aspects of Declarative Languages. Springer, 357–375. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. Tim Lindholm, Frank Yellin, Gilad Bracha, and Alex Buckley. 2014. The Java Virtual Machine Specification: Java SE 8 Edition. Pearson Education. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Sam Madden. 2017. 6.830 Lab 1: SimpleDB. (2017). http://db.csail.mit.edu/6.830/assignments/lab1.htmlGoogle ScholarGoogle Scholar
  39. Leon Moonen. 2001. Generating Robust Parsers using Island Grammars. In Reverse Engineering, 2001. Proceedings. Eighth Working Conference on. IEEE, 13–22. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Peter D. Mosses. 2004. Modular Structural Operational Semantics. J. Log. Algebr. Program. 60-61 (2004), 195–228.Google ScholarGoogle Scholar
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. 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 ScholarGoogle Scholar
  43. PUC-Rio. 2016. Lua: Test suites. Version 5.3.3. https://www.lua.org/tests/ . (2016).Google ScholarGoogle Scholar
  44. Semantic Designs, Inc. 2005. Test Coverage tools. http://www.semanticdesigns.com/Products/TestCoverage/ . (2005).Google ScholarGoogle Scholar
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. Wouter Swierstra. 2008. Data Types à la Carte. Journal of Functional Programming 18, 04 (2008), 423–436. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. ECMA TC39. 2014. Test262: ECMAScript Language Conformance Test Suite. Version 5.1. http://test262.ecmascript.org . (2014).Google ScholarGoogle Scholar
  48. Danny van Bruggen. 2016. JavaParser: Process Java code programmatically. (2016). http://javaparser.orgGoogle ScholarGoogle Scholar
  49. 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 ScholarGoogle Scholar
  50. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  51. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  52. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  53. Philip Wadler. 1998. The Expression Problem. Java-genericity mailing list (1998).Google ScholarGoogle Scholar
  54. Stefan Wellek. 2010. Testing Statistical Hypotheses of Equivalence and Noninferiority. CRC Press.Google ScholarGoogle Scholar
  55. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  56. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  57. Alan Zimmerman. 2016. language-javascript: Parser for JavaScript. http://hackage.haskell.org/package/ language-javascript-0.6.0.9 . (November 2016).Google ScholarGoogle Scholar

Index Terms

  1. One tool, many languages: language-parametric transformation with incremental parametric syntax

      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

      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!