▲ | mrkeen 3 days ago | |
> parse with the lalr generated parser, then if that rejects your string because the program was ill formed, call the hand rolled one for guesswork/diagnostics This feels like a recipe for disaster. If the hand-rolled parser won't match a formal grammar, why would it match the generated parser? The poor programmer will be debugging the wrong thing. It reminds me of my short stint writing C++ where I'd read undefined memory in release mode, but when I ran it under debug mode it just worked. | ||
▲ | senkora 3 days ago | parent | next [-] | |
> It reminds me of my short stint writing C++ where I'd read undefined memory in release mode, but when I ran it under debug mode it just worked. I assume it’s far too late at this point, but that almost always means that you’re invoking UB. Your next step should be enabling UBSan. | ||
▲ | JonChesterfield 3 days ago | parent | prev | next [-] | |
The generated parser will match the grammar. The hand rolled parser might do, but also might not, what with software being difficult and testing being boring and so forth. | ||
▲ | 8n4vidtmkvmk 3 days ago | parent | prev [-] | |
There's risk, but it seems like you could run both parsers against the same unit tests to help mitigate. |