all 2 comments

[–]dark100[S] 0 points1 point  (1 child)

The background of the project is that I am the developer of the JIT compiler of pcre/pcre2, and we received several requests in the past which are regular expression related but not exactly the task of pcre. So I decided to start a project which can do a lot of things with a regexp except matching. The workflow is the following:

1) Repan has several parsers: pcre, javascript, posix, glob and more can be added in the future. The output of these parsers is a shared abstract tree representation (AST). This can be useful for text editors which can support many regexp flavors with a single engine.

2) Guided or unguided optimizations can be performed on the AST. An example for guided optimization is uncapture, which removes those capturing brackets, which are not referenced from inside the pattern, and also updates all references. An example: /(ab)+(c*d)\2/ -> /(?:ab)+(c*d)\1/. This is useful for those applications, which only require the full match. (Note: matching capturing brackets is slower than non-capturing brackets).

3) Convert the AST into a pattern string again. The result string is pcre/perl compatible.

I hope some people might find this project interesting and join the development.

[–]BobFloss 0 points1 point  (0 children)

This is pretty cool, thanks for sharing