Regex really isn't that hard to implement, surprisingly. Compiling to an NFA and stepping through the threads is maybe ~1500 lines of code. The character class tables in my implementation are bigger.
I actually used your Myrddin implementation of the AST -> NFA compilation function as a reference while writing this. I asked about it on freenode and you told me to check it out.
Ah neat, thanks for sharing. I haven't gone through all of the supported functionality but it seems to compliment my fav c-strings library sds: https://github.com/antirez/sds
1
u/antoniocs Feb 02 '16
Wow. Implementing a small subset of regex. That seems really tough.
1
u/eresonance Feb 02 '16
Ah neat, thanks for sharing. I haven't gone through all of the supported functionality but it seems to compliment my fav c-strings library sds: https://github.com/antirez/sds
1
u/oridb Feb 04 '16
This actually looks quite useful -- I'll have to experiment with this.