ES RegExp processor

Dmitry Soshnikov dmitry.soshnikov at
Sat Apr 15 20:41:42 UTC 2017

(this is mostly an FYI post on JS regexes processing tool)

Recently I've been posting about ES RegExp parser[1], which eventually got
evolved into a generic ES RegExp processor (called `regexp-tree`). This can
be used for different kinds of purposes, and regarding ECMAScript spec --
it can be used to check/implement new proposals, new syntax, etc.

Currently the tool includes the following modules:

- Parser (including support for recent stage 3 proposals)
- Traversal
- Generic transformer
- Optimizer
- Compat-transpiler
- Interpreter (work in progress)

For example, the `optimizer`[2] module is capable of translating, and
fixing your regexes from:


To equivalent:


There is also an ESLint plugin with auto-fixing exist for it.

And the `compat-transpiler`[3] can be used to run/translate named capturing
groups, "dotAll" flag, etc.


Translated into (with tracking group names for further runtime purposes):


The `interpreter` module can be used to actually run new regexes, or check
semantics of the spec, when new features are added. This may follow at
implementation an actual ES spec (and other DFA/NFA engines can be built).
Note: there is also a way to run newer regexes using compat-transpiler.

Please feel free to reach me in case you have any questions, or would like
to add/implement any new feature in the tool.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list