fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
5 stars 0 forks source link

Pattern bindings #47

Open fmease opened 3 years ago

fmease commented 3 years ago

A pattern binding is a way to bind a subpattern to a name. Not to be confused with pattern binders. We probably need a better names (having bindings and binders is really confusing and seem arbitrarily assigned).

This adds the syntax "(" Lower-Pattern "as" Identifier ")" (or something similar depending on the precedence and associativity of as).

Example:

thing (value: Duple Nat Foo): Unit =
    case value of
        duple 0 ((foo \_) as a) => unit
        \_ => unit