3 ms·
Few parser generators do well on things like error reporting in a human friendly manner. In effect production parsers tends to end up being hand written or exte
by vidarh 5y ago
Few parser generators do well on things like error reporting in a human friendly manner. In effect production parsers tends to end up being hand written or extensively hand-modified for that reason. I wish more work on parser generators would involve focusing on better diagnostics (for end users, not the parser developer) and reporting rather than making them easier to use for the parser writers, as "just" writing the parser is rarely the hard part.
EDIT: Even making it easier to annotate the parser specifications to improve error reporting would be an improvement for many parser generators. In the past I've experimented with parser generators that included a prolog-inspired "cut" like operator that stops further backtracking, and that'd take an error message to output if nothing further can be matched without backtracking. It'd prevent the parser from "escaping" out of a likely human error and end up reporting a failure to match productions much higher up. It worked fairly well, and mimics what human parser writers tends to do in recursive descent parsers - we'll often guess at the likely error based on context deep down and bail out.