From 6fd622a57316e542c9ff279ddfb1fc1253582140 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Sat, 1 Jul 2023 00:26:11 -0600 Subject: [PATCH] Moved compound literals to primary in grammar --- grammar.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/grammar.txt b/grammar.txt index 17e22b9..ac928fd 100644 --- a/grammar.txt +++ b/grammar.txt @@ -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 ) )* )? ")" ;