EUVIMEDEUVIMED entdecken
Open Access · CC BY 4.0

A Pretty Expressive Printer

Sorawee Porncharoenwase, Justin Pombrio, Emina Torlak

Proceedings of the ACM on Programming Languages · 16.10.2023 · 7 (OOPSLA2) · 1122-1149

DOI: 10.1145/3622837 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Proceedings of the ACM on Programming Languages, online erschienen am 16.10.2023. Verfasst von Sorawee Porncharoenwase und 2 weiteren Autor:innen. Die Arbeit wurde bisher 1-mal zitiert (Crossref) und nennt 29 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY 4.0). Gefördert von: NSF.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

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, Π e , that is strictly more expressive than all pretty printers in the literature and provably minimizes an optimality objective. Furthermore, the time complexity of Π e is better than many existing pretty printers. When choosing among different ways to lay out a document, Π e consults a user-supplied cost factory , which determines the optimality objective, giving Π e a unique degree of flexibility. We use the Lean theorem prover to verify the correctness (validity and optimality) of Π e , and implement Π 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.

Förderung

  • NSF

Zitieren

APA

Porncharoenwase, S., Pombrio, J., & Torlak, E. (2023). A Pretty Expressive Printer. Proceedings of the ACM on Programming Languages, 7(OOPSLA2), 1122-1149. https://doi.org/10.1145/3622837

Vancouver

Porncharoenwase S, Pombrio J, Torlak E. A Pretty Expressive Printer. Proceedings of the ACM on Programming Languages. 2023;7(OOPSLA2):1122-1149. doi:10.1145/3622837

BibTeX
@article{Porncharoenwase2023,
  author = {Porncharoenwase, Sorawee and Pombrio, Justin and Torlak, Emina},
  title = {A Pretty Expressive Printer},
  journal = {Proceedings of the ACM on Programming Languages},
  year = {2023},
  volume = {7},
  number = {OOPSLA2},
  pages = {1122--1149},
  doi = {10.1145/3622837}
}
Kostenlos starten →