paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Biparsers: Exact Printing for Data Synchronisation

Biparsers:面向数据同步的精确打印
POPL 9(POPL)2025匹配度 2/10 · 该论文研究函数式编程中的 biparser/lens 与数据序列化格式的精确打印,属于程序语言与DSL方向,但未涉及用户画像中的静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析等核心主题。引用 3 inbox
Ruifeng Xie, Tom Schrijvers, Zhenjiang Hu
crossref: 2026-09-10

AI 速览

一句话:提出首个支持非单射解析器精确打印的 biparser 框架,用 lens 统一解析与打印,并实现 JSON/YAML 子集。

在不同序列化格式间同步数据时,解析器与打印器密切相关,但为解析出的数据恢复原始源文本(精确打印)仍具挑战,尤其对非单射解析器。本文把解析器-打印器对视为输入文本与数据之间的同步机制,并将其形式化为双向程序(lens),提出首个支持非单射解析器精确打印的 biparser 框架。该框架提供常用模式的组合子库,并给出 JSON 与 YAML 子集的 biparser 实现,展示其可用性。

问题
解析器与打印器虽可从单一定义派生,但现有方法难以支持精确打印,即为解析数据恢复原始源文本,非单射解析器下尤为困难。
方法
将解析器-打印器对建模为同步输入文本与数据的双向程序(lens),设计支持非单射解析器精确打印的 biparser 框架,并提供组合子库。
评估
为 JSON 和 YAML 子集实现 biparser,并展示该框架的可用性。
原文摘要(Abstract)

Parsers and printers are vital for data synchronisation between different serialisation formats. As they are tightly related, much research has been devoted to showing that both can be derived from a single definition. It, however, turns out to be challenging to extend this work with exact-printing , which recovers the original source text for the parsed data. In this paper, we propose a new approach to tackling the challenge that considers a parser-printer pair as a mechanism to synchronize the input text string with the data, and formalizes them as a bidirectional program (lens). We propose the first biparser framework to support exact-printing with non-injective parsers, provide a library of combinators for common patterns, and demonstrate its usefulness with biparsers for subsets of JSON and YAML.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@article{XieSH25,
  title = {Biparsers: Exact Printing for Data Synchronisation},
  author = {Ruifeng Xie and Tom Schrijvers and Zhenjiang Hu},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {POPL},
  year = {2025},
  doi = {10.1145/3704910}
}