Skip to main content

Crate perex

Crate perex 

Source
Expand description

Perex: an ECMAScript regex engine with explicit host memory ownership.

An experimental compiler, ordered evaluator, lossless borrowed input cursors and UTF-16 spans are implemented. Full ECMAScript coverage and efficient host resumption are outstanding; the embedding API and format are unstable.

The implementation will expose one compiler and matcher, immutable relocatable programs, caller-controlled scratch, lossless subject access, and capture spans. Hosts remain responsible for object allocation and GC.

See the repository’s architecture and memory contract for the requirements.

Modules§

binding
Owner-bound validation for immutable storage that may relocate.
compiler
Bounded compilation into host-owned relocatable program storage.
dfa
A lazy deterministic automaton over host-owned storage: whether a program matches, and the bounds of its match, without backtracking. States are built from the program’s instructions when a search first reaches them and kept in a cache the host allocates, sizes and may move. See docs/dfa.md.
executor
One ordered evaluator with caller-owned scratch and resumable offset state.
input
Borrowed, lossless subject access. Positions always count UTF-16 code units.
literal
Exact execution of bounded start-anchored literal programs. This is a reading of the same immutable instructions as the evaluator, with no automaton, scratch, allocation, or retained subject storage.
native
The compilation tier described in docs/compilation.md.
program
Versioned, relocatable programs in caller-owned u32 storage.
span
Results use UTF-16 offsets, never pointers into subject storage.

Structs§

Budget
Work allowance shared across an entire compile or search operation. It is never reset when trying another start position or entering an assertion.

Functions§

install_unicode_properties
Install the immutable Unicode membership provider before compiling or validating programs that need properties or non-ASCII capture names.