diff options
Diffstat (limited to 'grammar.bnf')
| -rw-r--r-- | grammar.bnf | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/grammar.bnf b/grammar.bnf index 8715ad2..30b48f6 100644 --- a/grammar.bnf +++ b/grammar.bnf | |||
| @@ -5,7 +5,8 @@ statement ::= definition; | |||
| 5 | definition ::= 'def' def-spec '=' expression | 5 | definition ::= 'def' def-spec '=' expression |
| 6 | | 'def' '_' '=' expression; | 6 | | 'def' '_' '=' expression; |
| 7 | def-spec ::= IDENTIFIER arg-spec*; | 7 | def-spec ::= IDENTIFIER arg-spec*; |
| 8 | arg-spec ::= IDENTIFIER | '(' ')' | '_'; | 8 | arg-spec ::= '(' arg-spec ')' | IDENTIFIER | arg-spec-tuple | '_'; |
| 9 | arg-spec-tuple ::= '(' ')' | '(' arg-spec ',' arg-spec (',' arg-spec)* ','? ')'; | ||
| 9 | expression ::= binary-expression | unary-expression; | 10 | expression ::= binary-expression | unary-expression; |
| 10 | unary-expression ::= unop+ simple-expression; | 11 | unary-expression ::= unop+ simple-expression; |
| 11 | binary-expression ::= call-expression (binop call-expression)*; | 12 | binary-expression ::= call-expression (binop call-expression)*; |
| @@ -37,4 +38,6 @@ fn-expression ::= 'fn' arg-spec+ '->' expression | |||
| 37 | do-expression ::= 'do' expression (';' expression)* 'end'; | 38 | do-expression ::= 'do' expression (';' expression)* 'end'; |
| 38 | 39 | ||
| 39 | repl-program ::= (repl-statement ';'?)* '\n'; // currently, hard-limited by the newline :sweat_smile: | 40 | repl-program ::= (repl-statement ';'?)* '\n'; // currently, hard-limited by the newline :sweat_smile: |
| 40 | repl-statement ::= statement | expression; \ No newline at end of file | 41 | repl-statement ::= statement | expression; |
| 42 | |||
| 43 | // TODO: Note that arg-spec and simple-expression are getting similar, both in grammar and in parser code \ No newline at end of file | ||