News for hackers. Stuff that matters.
Re:Lessons from Writing a Compiler by necheffa on Thursday July 14, 2022 @07:44PM (#32102722)
As someone who has had to clean up (with backwards compatibility) after people who YOLO'd custom grammars rather than actually taking the time to respect the mathematics of parsing and design ambiguity out up front...

I cannot disagree with you more.

Re:Lessons from Writing a Compiler by astrange on Thursday July 14, 2022 @07:51PM (#32102785)
I mean, I think you should read a book on parsing theory, just not that one. I like "Parsing Techniques: A Practical Guide" but there might be a newer better one.

But clang and gcc both have handwritten recursive-descent parsers for C/C++. (C++ parsing of course is undecidable, or at least used to be.)

Re:Lessons from Writing a Compiler by samatman on Thursday July 14, 2022 @11:11PM (#32104205)
C++ parsing being undecidable, and C having the Most Vexing Parse, are the classic arguments for developing a grammar using a parser generator, and only when the grammar is mature, write a handrolled implementation using the grammar as a reference.

I happen to think generating useful software from declarative grammar specifications is, hmm. Not limited to what such frameworks have been capable of to date. Although if you've only worked with yacc/bison, and never ANTLR, you may be underestimating the quality of a generated parser with respect to error recovery and messages. The state of the art has advanced, I don't think anyone would claim parity with artisanal handcrafted softwares, but we can get a lot more than "barf: shift-reduce bunchanumbers" these days.

Re:Lessons from Writing a Compiler by zabzonk on Thursday July 14, 2022 @11:30PM (#32104310)
> and C having the Most Vexing Parse

C++ too. Just to be pedantic.