Mon 24 Jun 2019 16:00 - 16:20 at 224AB - Parsing Chair(s): Qirun Zhang

Automatically transforming programs is hard, yet critical for automated program refactoring, rewriting, and repair. Multi-language syntax transformation is especially hard due to heterogeneous representations in syntax, parse trees, and abstract syntax trees (ASTs). Our insight is that the problem can be decomposed such that (1) a common grammar expresses the central context-free language (CFL) properties shared by many contemporary languages and (2) open extension points in the grammar allow customizing syntax (e.g., for balanced delimiters) and hooks in smaller parsers to handle language-specific syntax (e.g., for comments). Our key contribution operationalizes this decomposition using a Parser Parser combinator (PPC), a mechanism that generates parsers for matching syntactic fragments in source code by parsing declarative user-supplied templates. This allows our approach to detach from translating input programs to any particular abstract syntax tree representation, and lifts syntax rewriting to a modularly-defined parsing problem. A notable effect is that we skirt the complexity and burden of defining additional translation layers between concrete user input templates and an underlying abstract syntax representation. We demonstrate that these ideas admit efficient and declarative rewrite templates across 12 languages, and validate effectiveness of our approach by producing correct and desirable lightweight transformations on popular real-world projects (over 50 syntactic changes produced by our approach have been merged into 40+). Our declarative rewrite patterns require an order of magnitude less code compared to analog implementations in existing, language-specific tools.

Mon 24 Jun
Times are displayed in time zone: (GMT-07:00) Tijuana, Baja California change

16:00 - 17:00: PLDI Research Papers - Parsing at 224AB
Chair(s): Qirun ZhangGeorgia Institute of Technology
pldi-2019-papers16:00 - 16:20
Rijnard van TonderCarnegie Mellon University, Claire Le GouesCarnegie Mellon University
DOI Pre-print Media Attached
pldi-2019-papers16:20 - 16:40
Neel KrishnaswamiComputer Laboratory, University of Cambridge, Jeremy YallopUniversity of Cambridge, UK
Link to publication DOI Pre-print
pldi-2019-papers16:40 - 17:00
Giovanni CampagnaStanford University, USA, Silei Xu, Mehrad MoradshahiStanford University, USA, Richard SocherSalesforce, USA, Monica S. LamStanford University, USA
Media Attached