DField SolutionsMérnöki stúdió · Budapest
Loading · Töltődik
Skip to content
Category: Automata theory

Statyx

A regex engine that won't backtrack.

What it is

Statyx is a regex engine built the textbook way: it parses the pattern, compiles it to an NFA via Thompson construction, then runs a set-of-states simulation so it never catastrophically backtracks. It supports bounded quantifiers and ships 16 tests, including the classic 'evil' pattern (a|aa)*c matching 60 a's in well under a millisecond. From-scratch and dependency-light, ready to download and run.

A Thompson-construction regex engine: parse → NFA → set-of-states simulation, with bounded quantifiers. 16 tests, including that the “evil” pattern (a|aa)*c matches 60 a's in well under a millisecond.

What's inside

The full source, the tests, and CI. Open it, read it, change it. A zero-dependency core, free, in the MIT spirit.

Run it after unzip

pnpm install && pnpm dev