arXivPreprintOpen accesscs.FL

Product-Linear POSIX Parsing

Yuya Uezato

Key points

From the paper's conclusion
  • 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|)$.

Abstract

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.

Read the paper

Discussion

Science Skim's AI key points, plus readers' public thoughts

Readers' thoughts

No reader thoughts yet.

Related papers