Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduce or-patterns, which allows to express alternatives within pattern matching, including in a deep subpattern. The compilation of or-patterns is rather simple: we simply try each alternative until one matches, and use the corresponding bindings. Typechecking or-patterns can be done following the process as for typechecking a whole match expression (which is also a disjunction of patterns), although the treatment of bound variables is a bit different. Most of thec complexity of this commit comes from the fact that we don't want to make `or` a language keyword, which would break backward compatibility. This is possible, because `or` in pattern can't be confused with an identifier, but it required some tweaking to make our LALR(1) parser accept this.
- Loading branch information