Programming with Composable Recursive Patterns and Transformations
Luyu Cheng, Florent Ferrari, Michael D. Adams, Lionel Parreaux
摘要
Data processing using traditional pattern matching syntax and direct recursive functions is straightforward to write but becomes awkward in ambiguous (i.e., nondeterministic) cases: when programmers wish to avoid backtracking, they often end up having to write complicated code that sacrifices clarity and modularity. However, when the tree language being matched is regular, better solutions are possible. This paper presents composable recursive patterns and transformations (CRPTs), a new programming language feature designed to tackle this problem. CRPTs resemble and act like recursive type definitions in a structurally-typed language, which can be composed seamlessly to type check programs, but they also have a runtime component: they are compiled into backtracking-free code that recognizes and transforms their input in linear time. They serve both to validate existing data—for example, when checking structured JSON input against a CRPT that acts as a data schema—and to transform data in a type-safe and efficient manner. We formalize the dynamic semantics of CRPTs, a static type system for them, and a translation into efficient code that executes in time linear in the size of the input and polynomial in the size of the pattern. We also demonstrate the practicality of CRPTs with an implementation in the MLscript programming language, which we evaluate against comparable existing approaches on several examples.
问问这篇 Paper
问问你的智能体。
Lune 读过与它相关的顶会 Paper,每个回答都会注明依据哪几篇。
相关 Paper
- The Ultimate Conditional SyntaxLuyu Cheng, Lionel ParreauxOOPSLA 2024 · 被引用 2 次
- Exact Recursive Probabilistic ProgrammingDavid Chiang, Colin McDonald, Chung-chieh ShanOOPSLA 2023 · 被引用 12 次
- Solvable Tuple Patterns and Their Applications to Program VerificationNaoki Kobayashi, Ryosuke Sato, Ayumi Shinohara, Ryo YoshinakaPLDI 2026
- Composing CRDTs Convergent by ConstructionAlexander Städing Dominguez, George Zakhour, Pascal Weisenburger, Guido SalvaneschiOOPSLA 2026
- Grisette: Symbolic Compilation as a Functional Programming LibrarySirui Lu, Rastislav BodíkPOPL 2023 · 被引用 10 次
