4 ms·
BioJulia has published Automa.jl, which is a pure-Julia regex engine that can insert arbitrary Julia code at compile time. Not to take away from Rusts regex wh
by jakobnissen 3y ago
BioJulia has published Automa.jl, which is a pure-Julia regex engine that can insert arbitrary Julia code at compile time.
Not to take away from Rusts regex which are far more advanced than Automa, but I just take issue with that library being the first time regex internals have been exposed as a library :)
- burntsushi 3y agoThese sound like two different things. PCRE2, for example, has support for "callouts" which sound similar to what you're saying? https://www.pcre.org/current/doc/html/pcre2callout.html https://www.pcre.org/current/doc/html/pcre2callout.html --- Other things like ragel and re2c have done similar things. What I'm talking about in this blog is very different from that. This is about taking the internals of the regex library itself and turning them in a separately versioned library that others can compose. This makes somewhat less sense for a backtracker because most backtrackers just have one engine: the backtracker. But an automata based library usually has many different engines that can be composed in different ways. Still, backtrackers have things they could expose but don't in practice, such as a regex parser and an AST.
- nsajko 3y agoYou're both correct. In the context of Julia, where compilation and run time are arbitrarily interleaved, something like re2c can be a library and used at run time.
- burntsushi 3y agoJust to be clear here, I mentioned re2c as an example of what my blog is not about. There is a category difference between "ask a regex engine to run arbitrary code" and "expose internals as a separately versioned library for others to compose as they want." They service different use cases.