summaryrefslogtreecommitdiff
path: root/grammar.bnf
diff options
context:
space:
mode:
Diffstat (limited to 'grammar.bnf')
-rw-r--r--grammar.bnf7
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;
5definition ::= 'def' def-spec '=' expression 5definition ::= 'def' def-spec '=' expression
6 | 'def' '_' '=' expression; 6 | 'def' '_' '=' expression;
7def-spec ::= IDENTIFIER arg-spec*; 7def-spec ::= IDENTIFIER arg-spec*;
8arg-spec ::= IDENTIFIER | '(' ')' | '_'; 8arg-spec ::= '(' arg-spec ')' | IDENTIFIER | arg-spec-tuple | '_';
9arg-spec-tuple ::= '(' ')' | '(' arg-spec ',' arg-spec (',' arg-spec)* ','? ')';
9expression ::= binary-expression | unary-expression; 10expression ::= binary-expression | unary-expression;
10unary-expression ::= unop+ simple-expression; 11unary-expression ::= unop+ simple-expression;
11binary-expression ::= call-expression (binop call-expression)*; 12binary-expression ::= call-expression (binop call-expression)*;
@@ -37,4 +38,6 @@ fn-expression ::= 'fn' arg-spec+ '->' expression
37do-expression ::= 'do' expression (';' expression)* 'end'; 38do-expression ::= 'do' expression (';' expression)* 'end';
38 39
39repl-program ::= (repl-statement ';'?)* '\n'; // currently, hard-limited by the newline :sweat_smile: 40repl-program ::= (repl-statement ';'?)* '\n'; // currently, hard-limited by the newline :sweat_smile:
40repl-statement ::= statement | expression; \ No newline at end of file 41repl-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