English

Formal Verification for JavaScript Regular Expressions: a Proven Semantics and its Applications (Extended Version)

Programming Languages 2026-04-08 v3

Abstract

We present the first mechanized, succinct, practical, complete, and proven-faithful semantics for a modern regular expression language with backtracking semantics. We ensure its faithfulness by proving it equivalent to a preexisting line-by-line embedding of the official ECMAScript specification of JavaScript regular expressions. We demonstrate its practicality by presenting two real-world applications. First, a new notion of contextual equivalence for modern regular expressions, which we use to prove or disprove rewrites drawn from previous work. Second, the first formal proof of the PikeVM algorithm used in many real-world engines. In contrast with the specification and other formalization work, our semantics captures not only the top-priority match, but a full backtracking tree recording all possible matches and their respective priority. All our definitions and results have been mechanized in the Rocq proof assistant.

Keywords

Cite

@article{arxiv.2507.13091,
  title  = {Formal Verification for JavaScript Regular Expressions: a Proven Semantics and its Applications (Extended Version)},
  author = {Aurèle Barrière and Victor Deng and Clément Pit-Claudel},
  journal= {arXiv preprint arXiv:2507.13091},
  year   = {2026}
}

Comments

27 pages, 3 pages of references, 6 pages of appendix

R2 v1 2026-07-01T04:06:01.979Z