Pretty printers make trade-offs between the expressiveness of their pretty printing language, the optimality objective that they minimize when choosing between different ways to lay out a document, and the performance of their algorithm. This paper presents a new pretty printer, $\Pi_e$, that is strictly more expressive than all pretty printers in the literature and provably minimizes an optimality objective. Furthermore, the time complexity of $\Pi_e$ is better than many existing pretty printers. When choosing among different ways to lay out a document, $\Pi_e$ consults a user-supplied cost factory, which determines the optimality objective, giving $\Pi_e$ a unique degree of flexibility. We use the Lean theorem prover to verify the correctness (validity and optimality) of $\Pi_e$, and implement $\Pi_e$ concretely as a pretty printer that we call PrettyExpressive. To evaluate our pretty printer against others, we develop a formal framework for reasoning about the expressiveness of pretty printing languages, and survey pretty printers in the literature, comparing their expressiveness, optimality, worst-case time complexity, and practical running time. Our evaluation shows that PrettyExpressive is efficient and effective at producing optimal layouts. PrettyExpressive has also seen real-world adoption: it serves as a foundation of a code formatter for Racket.
Wed 25 OctDisplayed time zone: Lisbon change
16:00 - 17:48 | |||
16:00 18mTalk | Fluent APIs in Functional Languages OOPSLA DOI Pre-print | ||
16:18 18mTalk | A Pretty Expressive Printer OOPSLA Sorawee Porncharoenwase University of Washington, Justin Pombrio Unaffiliated, Emina Torlak Amazon Web Services, USA DOI Pre-print | ||
16:36 18mTalk | How Domain Experts Use an Embedded DSL OOPSLA Lisa Rennels University of California at Berkeley, Sarah E. Chasins University of California at Berkeley DOI | ||
16:54 18mTalk | Saggitarius: A DSL for Specifying Grammatical Domains OOPSLA Anders Miltner Simon Fraser University, Devon Loehr Princeton University, Arnold Mong Princeton University, Kathleen Fisher Tufts University, David Walker Princeton University DOI | ||
17:12 18mTalk | Mat2Stencil: A Modular Matrix-Based DSL for Explicit and Implicit Matrix-Free PDE Solvers on Structured Grid OOPSLA Huanqi Cao Tsinghua University, Shizhi Tang Tsinghua University, Qianchao Zhu Peking University, Bowen Yu Tsinghua University, Wenguang Chen Tsinghua University; Pengcheng Laboratory DOI | ||
17:30 18mTalk | Translating canonical SQL to imperative code in Coq OOPSLA Véronique Benzaken Université Paris-Saclay - Laboratoire de Méthodes Formelles , Évelyne Contejean CNRS, ENS Paris-Saclay & Université Paris-Saclay, Houssem Hachmaoui , Chantal Keller Université Paris Saclay, Louis Mandel IBM Research, USA, Avraham Shinnar IBM Research, Jerome Simeon DocuSign, Inc. Link to publication DOI |