4 ms·
This was a good article! It's (reasonably) missing one of my favorite parsing algorithms, though, which is Might's "Parsing with Derivatives" [0, 1]. It's not v
by DonaldPShimoda 9y ago
This was a good article! It's (reasonably) missing one of my favorite parsing algorithms, though, which is Might's "Parsing with Derivatives" [0, 1]. It's not very efficient compared to some other algorithms, but I think it is very elegant conceptually.
[0] Blog post: http://matt.might.net/articles/parsing-with-derivatives/ http://matt.might.net/articles/parsing-with-derivatives/
[1] Paper: http://matt.might.net/papers/might2011derivatives.pdf http://matt.might.net/papers/might2011derivatives.pdf
[2] Improvements: https://michaeldadams.org/papers/derivatives2/derivatives2.pdf https://michaeldadams.org/papers/derivatives2/derivatives2.p...
- fithisux 9y agoThe author, according to my understanding, says that parsing with derivatives does not improve the state of the art either in terms of complexity or in terms of elegance. My personal opinion is that Matt Might uses a different avenue to derive the state of the art and even though the original algorithm can be trapped to exponential complexity, the improved analysis and amendments in the 2012 paper save the situation. I think it is quite an achievement to fight against so many experts who believed that the flaws could not be worked around and re-derive the state of art complexity. At least in the field of pure mathematics this has a very big value.
- cwzwarich 9y agoDid any experts actually say that the flaw couldn't be worked around? I thought the argument was just that working around the flaw gives you known algorithms.
- DonaldPShimoda 9y agoYou bring up good points! I think the efficiency in real-world applications is still not as good as alternative solutions, but what I really like about PWD is that it's a general parsing algorithm that's incredibly simple to understand (if you have a working knowledge of regular languages). The implementation can be a little more tricky (e.g. if you've never written a fix-point before[0]), but the actual concepts just seem so simple. PWD was actually one of the first parsing algorithms I learned about (odd, I know), and even without much prior knowledge of the field of parsing I was able to grasp the gist of it in a single sitting. [0] You can also just skip over establishing a fix-point if you guarantee that your language is not left-recursive.
- bgorman 9y agoThe author would be wise to look at clojure.spec, a project which has leveraged parsing with derivatives to revolutionize dynamic language data validation.