@@ -11,15 +11,15 @@ The grammar of the language in Extended Backus-Naur Form (EBNF).
1111- ``` { ... } ``` = zero or more
1212
1313``` ebnf
14- file ::= block
14+ file ::= { expr-or-stmt }
1515 import ::= [ "from" id ] "import" id { "," id } [ as id { "," id } ]
1616
17- type-def ::= "type" type [ ":" type ] ( newline block | "when" [ conditions ] )
18- conditions ::= ( newline indent { condition newline } dedent | condition )
17+ type-def ::= "type" type [ ":" type ] ( code- block | "when" [ conditions ] )
18+ conditions ::= "[" condition { newline condition } "]" | condition
1919 condition ::= expression [ "!" expression ]
2020 type-tuple ::= "(" [ type ] { "," type } ")"
2121
22- class ::= "class" id [ fun-args ] [ ":" ( type | type-tuple ) ] ( newline block )
22+ class ::= "class" id [ fun-args ] [ ":" ( type | type-tuple ) ] ( code- block )
2323 generics ::= "[" id { "," id } "]"
2424
2525 id ::= { character }
@@ -28,8 +28,6 @@ The grammar of the language in Extended Backus-Naur Form (EBNF).
2828 type ::= ( id [ generics ] | type-tuple ) [ "->" type ]
2929 type-tuple ::= "(" [ type { "," type } ] ")"
3030
31- block ::= indent { expr-or-stmt } dedent
32-
3331 expr-or-stmt ::= ( statement | expression ) [ comment ]
3432 statement ::= control-flow-stmt
3533 | definition
@@ -46,7 +44,7 @@ The grammar of the language in Extended Backus-Naur Form (EBNF).
4644 | "return" [ expression ]
4745 | expression "as" id
4846 | control-flow-expr
49- | newline block
47+ | code- block
5048 | collection
5149 | index
5250 | key-value
@@ -74,10 +72,10 @@ The grammar of the language in Extended Backus-Naur Form (EBNF).
7472
7573 variable-def ::= [ "fin" ] ( id-maybe-type | collection ) [ ":=" expression ] [ forward ]
7674 operator-def ::= [ "pure" ] overridable-op [ "(" [ id-maybe-type ] ")" ] "->" type
77- [ ":=" ( expr-or-stmt | newline block ) ]
75+ [ ":=" ( expr-or-stmt | code- block ) ]
7876
7977 fun-def ::= [ "pure" ] id fun-args [ "->" type ] [ raise ]
80- [ ":=" ( expr-or-stmt | newline block ) ]
78+ [ ":=" ( expr-or-stmt | code- block ) ]
8179 fun-args ::= "(" [ fun-arg ] { "," fun-arg } ")"
8280 fun-arg ::= id-maybe-type [ ":=" expression ]
8381 forward ::= "forward" id { "," id }
@@ -108,18 +106,20 @@ The grammar of the language in Extended Backus-Naur Form (EBNF).
108106 e-notation ::= ( integer | real ) "E" [ "-" ] integer
109107 string ::= """ { character } """
110108
111- newline-block ::= newline block | expr-or-stmt
109+ code-block ::= "[" expr-or-statement "]"
110+ | expr-or-stmt
111+ | "[" newline expr-or-statement { newline expr-or-statement } "]"
112112 one-or-more-expr ::= expression { "," expression }
113113
114114 control-flow-expr::= if | match
115- if ::= "if" one-or-more-expr "then" newline -block [ "else" newline -block ]
115+ if ::= "if" one-or-more-expr "then" code -block [ "else" code -block ]
116116 match ::= "match" one-or-more-expr "with" newline match-cases
117- match-cases ::= indent { match-case { newline } } dedent
117+ match-cases ::= match-case | "[" match-case { newline match-case } "]"
118118 match-case ::= expression "=>" expr-or-stmt
119119
120120 control-flow-stmt::= while | foreach | "break" | "continue"
121- while ::= "while" one-or-more-expr "do" newline -block
122- foreach ::= "for" one-or-more-expr "in" expression "do" newline -block
121+ while ::= "while" one-or-more-expr "do" code -block
122+ foreach ::= "for" one-or-more-expr "in" expression "do" code -block
123123
124124 newline ::= newline-char
125125 newline-char ::= \n | \r\n
0 commit comments