Pat | ::= | Integer | matches integer literal |
| | | Real | matches real literal |
| | | Char | matches character literal |
| | | Quark | matches quark literal |
| | | String | matches string literal |
| | | Regexp | matches any string that matches regexp |
| | | Pat_Var | a pattern variable; matches anything |
| | | _ | wild card; matches anything |
| | | Cons | matches a datatype constructor |
| | | Cons PatArg | a constructor application pattern |
| | | Id as Pat | binds a variable to the sub-pattern |
| | | Pat : Type_Exp | typed pattern |
| | | Pat - - Pat | matches either pattern |
| | | Pat && Pat | matches both patterns |
| | | ! Pat | matches anything but the pattern |
| | | ( Pat ) | Grouping |
| | | #[ Pat, ¼ , Pat ] | list pattern; exact length match |
| | | #[ Pat, ¼ , Pat ... ] | list pattern;
non-exact length match |
| | | [ - Pat, ¼ , Pat - ] | vector pattern; exact length match |
| | | [ - Pat, ¼ , Pat ... - ]
| vector pattern; matches to the left |
| | | [ - ... Pat, ¼ , Pat - ]
| vector pattern; matches to the right |
PatArg | ::= | Pat |
| | | ( Pat, ¼ , Pat ) |
| | | { Lab_Pat, ¼ , Lab_Pat [ ... ] } |
Lab_Pat | ::= | Id = Pat |
Pat_Var | ::= | Id |
| | | ?Id |
|