Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces or-patterns, which allows to express alternatives within patterns, 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 of or-patterns can be done following the same 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 the complexity of this commit comes from the fact that we don't want to make `or` a reserved language keyword, which would break backward compatibility. This is possible, because `or` in pattern can't be confused with an identifier, but it requires some tweaking to make our LALR(1) parser accept this.
- Loading branch information