From 8565a173591e4748ac910b4b982dff96bb5dfd60 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 18 Aug 2024 23:01:58 +0800 Subject: Added Nothing/empty-tuple arguments --- grammar.bnf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'grammar.bnf') diff --git a/grammar.bnf b/grammar.bnf index 7c18f8f..9ddaffc 100644 --- a/grammar.bnf +++ b/grammar.bnf @@ -4,7 +4,7 @@ program ::= (statement ';'?)*; statement ::= definition | expression; definition ::= 'def' def-spec '=' expression; def-spec ::= IDENTIFIER arg-spec*; -arg-spec ::= IDENTIFIER; +arg-spec ::= IDENTIFIER | '(' ')'; expression ::= binary-expression | unary-expression; unary-expression ::= unop+ simple-expression; binary-expression ::= call-expression (binop call-expression)*; @@ -13,6 +13,7 @@ binop ::= '*' | '/' | '+' | '-' | '?=' | '/=' | '>' | '>=' | '<' | '<='; unop ::= '+' | '-' | '!'; simple-expression ::= '(' expression ')' | 'true' | 'false' + | '(' ')' | INTEGER | IDENTIFIER | STRING @@ -22,7 +23,7 @@ simple-expression ::= '(' expression ')' | fn-expression | do-expression; -array ::= '(' ')' | '[' ']' | '[' expression (',' expression)* ','? ']'; +array ::= '[' ']' | '[' expression (',' expression)* ','? ']'; if-else-expression ::= 'if' expression 'then' expression 'else' expression; let-in-expression ::= 'let' def-spec '=' expression ('and' def-spec '=' expression)* 'in' expression; -- cgit v1.2.3