3 ms·
What do you mean by "in the wild"? I would have thought it was the opposite. Handwritten recursive descent is the way to build a parser if most compiler project
by CipherThrowaway 4y ago
What do you mean by "in the wild"? I would have thought it was the opposite. Handwritten recursive descent is the way to build a parser if most compiler projects are to go by. OpenJDK, GCC, Clang, Rust, Spidermonkey are examples. Occasionally you see a generated lexer but generated parsers seem to be a rarity in practice while recursive descent is ubiquitous.
- ChrisMarshallNY 4y agoIn my case, I have not had occasion to write compilers and parsers. I've used parsers that others have written, frequently. But, like I said, the idea behind it was quite useful, to me. I use recursion all the time, and RDPs are a pretty "pure" form of recursion.
- CipherThrowaway 4y agoYes I agree. There is something quite elegant and fundamental about recursive descent parsing.
- eatonphil 4y agoMost SQL systems (postgres, mysql, sqlite) use generated parsers but yeah other than that handwritten is the norm. Is there a reason for that? None that I can think of. SQL systems tend to have worse error messages but I don't believe parser generators require error messages to be as bad as SQL error messages (I'm talking about how they often don't give line number or column number info). So my guess (and it sounds kind of absurd to say) is that most SQL systems just don't put much thought into parsing. And not that parser generators fit the domain better.
- eru 4y agoFor quickly writing a parser that doesn't necessarily have to have the highest performance, parser generator libraries are another neat possibility beyond rolling your own parser from scratch or using a generator.