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