Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
No backtracking error, extend the choice operator with `\`. #30
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
Jul 30, 2016
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.