Added when expressions to grammar

This commit is contained in:
Brandon Dyck 2023-06-29 10:10:41 -06:00
parent e508d06b1a
commit 138508732f

View File

@ -21,8 +21,10 @@ operator ->
| "++" ; | "++" ;
control -> control ->
| if | if
// | when | when
if -> "if" expression "then" expression "else" expression ; if -> "if" expression "then" expression "else" expression ;
variant_pattern -> "`" identifier ( "(" ( ( "_" | identifier ) ( "," ( "_" | identifier )* )? ) ")" )? ;
when -> "when" expression "is" ( variant_pattern "=>" expression )+ ;
compound -> variant | record | list ; compound -> variant | record | list ;
variant -> "`" identifier ( "(" ( expression ( "," expression)* )? ")" )? ; variant -> "`" identifier ( "(" ( expression ( "," expression)* )? ")" )? ;
base_record -> expression ( "with" identifier "=" expression ( "," "with" identifier "=" expression )* )? base_record -> expression ( "with" identifier "=" expression ( "," "with" identifier "=" expression )* )?