Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Or patterns #1916

Merged
merged 1 commit into from
May 25, 2024
Merged

Or patterns #1916

merged 1 commit into from
May 25, 2024

Commits on May 25, 2024

  1. Or patterns

    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.
    yannham committed May 25, 2024
    Configuration menu
    Copy the full SHA
    063c6f1 View commit details
    Browse the repository at this point in the history