batavia icon indicating copy to clipboard operation
batavia copied to clipboard

Implement regular expression library (re)

Open swenson opened this issue 7 years ago • 5 comments

Most of re is written in C in CPython, meaning we have to find an alternative.

One possibility is PyPy's implementation, which appears to be mostly written in RPython:

https://bitbucket.org/pypy/pypy/src/b0e70c0c2ac0d1b8a066b64eb94bd3b858a9be8f/rpython/rlib/rsre/?at=default

We could possibly, with some modifications, load this, similarly to how we load in ouroboros modules.

swenson avatar Oct 08 '16 04:10 swenson

Well, there is JavaScript's native RegExp... though converting Python's extensions to its syntax would be hard work anyway. (and, amusingly enough, would require extra regexes)

ElSaico avatar Nov 01 '16 18:11 ElSaico

Taking the old sre module from Python <= 2.4 and backporting later stuff is also an option.

ElSaico avatar Nov 01 '16 19:11 ElSaico

Is the sre module from Python <= 2.4 written in pure Python? If so, I'd definitely be into that as a start. Even if we aren't 100% compatible with the latest stuff, getting basic re working would be a huge step.

swenson avatar Nov 01 '16 19:11 swenson

It is!

And the only hard new part seems to be the flags thing; everything else looks trivial.

ElSaico avatar Nov 01 '16 19:11 ElSaico

Awesome! I'd love to see some work on that then :)

swenson avatar Nov 01 '16 19:11 swenson