summaryrefslogtreecommitdiff
path: root/grammar.bnf
diff options
context:
space:
mode:
Diffstat (limited to 'grammar.bnf')
-rw-r--r--grammar.bnf5
1 files changed, 3 insertions, 2 deletions
diff --git a/grammar.bnf b/grammar.bnf
index 7c18f8f..9ddaffc 100644
--- a/grammar.bnf
+++ b/grammar.bnf
@@ -4,7 +4,7 @@ program ::= (statement ';'?)*;
4statement ::= definition | expression; 4statement ::= definition | expression;
5definition ::= 'def' def-spec '=' expression; 5definition ::= 'def' def-spec '=' expression;
6def-spec ::= IDENTIFIER arg-spec*; 6def-spec ::= IDENTIFIER arg-spec*;
7arg-spec ::= IDENTIFIER; 7arg-spec ::= IDENTIFIER | '(' ')';
8expression ::= binary-expression | unary-expression; 8expression ::= binary-expression | unary-expression;
9unary-expression ::= unop+ simple-expression; 9unary-expression ::= unop+ simple-expression;
10binary-expression ::= call-expression (binop call-expression)*; 10binary-expression ::= call-expression (binop call-expression)*;
@@ -13,6 +13,7 @@ binop ::= '*' | '/' | '+' | '-' | '?=' | '/=' | '>' | '>=' | '<' | '<=';
13unop ::= '+' | '-' | '!'; 13unop ::= '+' | '-' | '!';
14simple-expression ::= '(' expression ')' 14simple-expression ::= '(' expression ')'
15 | 'true' | 'false' 15 | 'true' | 'false'
16 | '(' ')'
16 | INTEGER 17 | INTEGER
17 | IDENTIFIER 18 | IDENTIFIER
18 | STRING 19 | STRING
@@ -22,7 +23,7 @@ simple-expression ::= '(' expression ')'
22 | fn-expression 23 | fn-expression
23 | do-expression; 24 | do-expression;
24 25
25array ::= '(' ')' | '[' ']' | '[' expression (',' expression)* ','? ']'; 26array ::= '[' ']' | '[' expression (',' expression)* ','? ']';
26 27
27if-else-expression ::= 'if' expression 'then' expression 'else' expression; 28if-else-expression ::= 'if' expression 'then' expression 'else' expression;
28let-in-expression ::= 'let' def-spec '=' expression ('and' def-spec '=' expression)* 'in' expression; 29let-in-expression ::= 'let' def-spec '=' expression ('and' def-spec '=' expression)* 'in' expression;