diff options
Diffstat (limited to 'grammar.bnf')
| -rw-r--r-- | grammar.bnf | 5 |
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 ';'?)*; | |||
| 4 | statement ::= definition | expression; | 4 | statement ::= definition | expression; |
| 5 | definition ::= 'def' def-spec '=' expression; | 5 | definition ::= 'def' def-spec '=' expression; |
| 6 | def-spec ::= IDENTIFIER arg-spec*; | 6 | def-spec ::= IDENTIFIER arg-spec*; |
| 7 | arg-spec ::= IDENTIFIER; | 7 | arg-spec ::= IDENTIFIER | '(' ')'; |
| 8 | expression ::= binary-expression | unary-expression; | 8 | expression ::= binary-expression | unary-expression; |
| 9 | unary-expression ::= unop+ simple-expression; | 9 | unary-expression ::= unop+ simple-expression; |
| 10 | binary-expression ::= call-expression (binop call-expression)*; | 10 | binary-expression ::= call-expression (binop call-expression)*; |
| @@ -13,6 +13,7 @@ binop ::= '*' | '/' | '+' | '-' | '?=' | '/=' | '>' | '>=' | '<' | '<='; | |||
| 13 | unop ::= '+' | '-' | '!'; | 13 | unop ::= '+' | '-' | '!'; |
| 14 | simple-expression ::= '(' expression ')' | 14 | simple-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 | ||
| 25 | array ::= '(' ')' | '[' ']' | '[' expression (',' expression)* ','? ']'; | 26 | array ::= '[' ']' | '[' expression (',' expression)* ','? ']'; |
| 26 | 27 | ||
| 27 | if-else-expression ::= 'if' expression 'then' expression 'else' expression; | 28 | if-else-expression ::= 'if' expression 'then' expression 'else' expression; |
| 28 | let-in-expression ::= 'let' def-spec '=' expression ('and' def-spec '=' expression)* 'in' expression; | 29 | let-in-expression ::= 'let' def-spec '=' expression ('and' def-spec '=' expression)* 'in' expression; |