Re:Building a Regex Engine in Fewer Than 40 Lines of Code
by 13throwaway37 on Tuesday December 05, 2017 @05:54AM
(#15851029)
Literally the first sentence in the posted article mentions this:
I stumbled upon an article the other day where Rob Pike implements a rudimentary regular expression engine in c. I converted his code to Javascript and added test specs so that someone can self-guide themselves through the creation of the regex engine. The specs and solution can be found in this GitHub repository.
Re:Building a Regex Engine in Fewer Than 40 Lines of Code
by why-el on Tuesday December 05, 2017 @07:12AM
(#15851255)
If you liked that chapter, check out some recent ideas of his here: https://www.youtube.com/watch?v=HxaD_trXwRE.
I think it's the same implementation described here: http://www.cs.princeton.edu/courses/archive/spr09/cos333/bea... (not 100% sure as I lost my copy of Beautiful Code :()
EDIT: I see the author links to the article at the beginning of the post. Still, I missed this on my first reading, so I think posting the link here is still worthwhile. Especially because the translation to JS kind of misses the point - the beauty of the Rob's implementation comes from recursion and pointers and JS lacks the latter.