3 ms·
From the parsers I see in the wild (not strictly speaking about compilers here), I think most programmers should definitely spend some time studying the basics
by eska 3y ago
From the parsers I see in the wild (not strictly speaking about compilers here), I think most programmers should definitely spend some time studying the basics of them. It’s incredible to me how people mess up parsing even the simplest of file formats or make it super complicated.
- wwweston 3y agoHi, my name is Weston, and I'm bad at parsing (and it hurts the whole time I do it because I'm just barely clever enough to do it badly/dangerously). What else should I study besides the first 5 chapters of the 2nd edition of the dragon book?
- turndown 3y agoAn easy to reach for activity that usually involves parsing is stuff like Advent of Code, where there is almost always a parsing step.
- eska 3y agoSorry if I misinterpreted your comment, but the last sentence reads like a snark. Why did you have to go from “the basics” to “read half a compiler book”? Most developers don’t even seem to read a single Wikipedia article on it.
- kaba0 3y agoWell - do you want to be good at parsing/has any need for it? Even if you write your own programming language you are much better off using something like ANTLR to generate your grammar — the advantage is a well-specified standard description of your own grammar and no parser bugs. Though mind you, not everyone shares my sentiment here, last time I wrote that people were adamant about hand-written parsers.
- Buttons840 3y agoI'm having flashbacks to a well funded startup I used to work at. People seemed to think that to how to handle having commas in data while still being able to use CSV files was an area of active research. At, like, a dozen different layers in the application we would strip commas from any and all strings, but they would still frequently slip through and screw up the entire pipeline. The complaints I made about this quickly used up what little political capital I had. The joys of `str.split ','` based CSV "parsing".
- xiphias2 3y agoYou don't need to complain for this, just fix the code in all places by calling a better csv parser that you can also write.
- noelwelsh 3y agoI think people should know about parsing, but I don't think the material on parsing in most compiler books (LL parsing, shift-reduce conflicts, etc.) is particularly relevant. I've had good experiences using parser combinator libraries. They are straight-forward to use, and to write, and expressive. Beyond that, it's seeing how to breakdown a parsing problem into a grammar that I think is the main skill.
- marginalia_nu 3y agoYou'll never catch me, batman! You'll have to pry recursive descent from my cold shrivelled cobol-fingers.