That was bad design in "yacc". To get decent diagnostics out of a parser generator of that type, error outputs need to indicate the last point at which the parser was on a unique, successful path, and where the parser input stream is at the error. The problem in the input is between those two points.
Between those points, the parser was working on several alternate possible parsings, none of which could be completed. Give the names of those grammar constructs to the user. So an error message should look like:
struct point { float x, float y };
^^^^^^^^^ Expected one of:
<structure-variable-name>
;
}
Between those points, the parser was working on several alternate possible parsings, none of which could be completed. Give the names of those grammar constructs to the user. So an error message should look like: