计算机科学 > 形式语言与自动机理论
[提交于 2026年11月25日]
标题:Product-Linear POSIX Parsing
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:POSIX regular-expression matching reports capture spans determined by the parse tree that its disambiguation rules select. Thompson's classical construction decides whether an expression $E$ matches a text $w$ in product-linear time, $O(|E|\,|w|)$. Whether the POSIX parse can also be computed in product-linear time has remained open since the rules were standardized in 1992. For instance, the algorithm of Okui and Suzuki takes $O(|E|^2|w|)$ time after precomputation. We give, to our knowledge, the first algorithm that computes the POSIX parse and all capture spans in product-linear total time, $O(|E|\,|w|)$. It uses $O(|E|+|w|)$ working space and supports full matching, longest-prefix matching, and leftmost-longest search. The algorithm scans the text backward and keeps one preferred continuation per traversal state. It implements POSIX selection with lists of end positions of the open subexpressions, which it compares and updates in constant time.
提交历史
来自:Yuya Uezato[v1] 2026年11月25日 星期三 18:53:43 UTC (53 KB)