batavia
batavia copied to clipboard
Implement regular expression library (re)
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.
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)
Taking the old sre
module from Python <= 2.4 and backporting later stuff is also an option.
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.
It is!
And the only hard new part seems to be the flags thing; everything else looks trivial.
Awesome! I'd love to see some work on that then :)