diff --git a/grammar.txt b/grammar.txt index dea4e6a..73af91c 100644 --- a/grammar.txt +++ b/grammar.txt @@ -21,8 +21,10 @@ operator -> | "++" ; control -> | if -// | when + | when if -> "if" expression "then" expression "else" expression ; +variant_pattern -> "`" identifier ( "(" ( ( "_" | identifier ) ( "," ( "_" | identifier )* )? ) ")" )? ; +when -> "when" expression "is" ( variant_pattern "=>" expression )+ ; compound -> variant | record | list ; variant -> "`" identifier ( "(" ( expression ( "," expression)* )? ")" )? ; base_record -> expression ( "with" identifier "=" expression ( "," "with" identifier "=" expression )* )?