This approach is different from existing error reporting mechanism, it leaves the user to report himself the error (which is often desirable in compiler—for better error messages) instead of trying to generate automatically all the errors. Note that we still generate errors if the user didn't specify anything so it lets the user free to improve the grammar later.
We are sometimes sure that if a rule fails, the program can't be correct. It often happens after a specific keyword has been encountered. For example in Rust, a let must be followed by a declaration:
If we parse the "let" but that decl fail, it's useless to backtrack and can put a context-sensitive message here:
We use the
\character because it's a bit like the dual of the choice: if the rule succeed it will fail (instead of succeed).
The text was updated successfully, but these errors were encountered: