Moved compound literals to primary in grammar

This commit is contained in:
Brandon Dyck 2023-07-01 00:26:11 -06:00
parent 6f3c82cad1
commit 6fd622a573

View File

@ -4,7 +4,6 @@ expression ->
| unary
| binary
| let
| compound
| control
| selector
| index
@ -28,14 +27,13 @@ control ->
| when
if -> "if" expression "then" expression "else" expression ;
when -> "when" expression "is" ( ( identifier | pattern ) "=>" expression )+ ;
compound -> variant | record | list ;
variant -> "`" identifier ( "(" expression ")" )? ;
base_record -> expression ( "with" identifier "=" expression ( "," "with" identifier "=" expression )* )?
record ->
"{" ( identifier ("=" expression)? ( "," identifier ("=" expression)? )* )? ( "|" base_record )* "}" ;
list -> "[" ( expression ( "," expression )* )? "]" ;
identifier -> IDENTIFIER | "@" STRING ;
operand -> ( NUMBER | STRING | identifier | "(" expression ")" ) ;
operand -> ( NUMBER | STRING | identifier | "(" expression ")" | record | variant | list) ;
selector -> "." identifier ;
index -> "[" expression "]" ;
arguments -> "(" ( "_" | expression ( "," ( "_" | expression ) )* )? ")" ;