Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I also find this to be an elegant way of doing this, and it is also how the Thompson VM style of regex engines work [0]

It's a bit harder to adapt the technique to parsers because the Thompson NFA always increments the sequence pointer by the same amount, while a parser's production usually has a variable size, making it harder to run several parsing heads in lockstep.

[0] https://swtch.com/~rsc/regexp/regexp2.html





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: