39 lines
1.4 KiB
EBNF
39 lines
1.4 KiB
EBNF
<program> ::= { DeclarationStart <declaration> }
|
|
|
|
<declaration> ::= Symbol Colon <expr> DeclarationStart Symbol { Symbol } Assign <expr>
|
|
<variant_declaration> ::= Symbol { <grouped_type> }
|
|
|
|
<expr> ::= If <expr> <ifblock>
|
|
| <let> { <let> } In <expr>
|
|
| <infix_expr>
|
|
| Type <expr>
|
|
<tightexpr> ::= Literal
|
|
| Symbol
|
|
| OpenParen <expr> CloseParen
|
|
|
|
<let> ::= Let Symbol Assign <expr>
|
|
|
|
<ifblock> ::= Is <case> { Comma <case> } [ Comma ]
|
|
| Then <expr> Else <expr>
|
|
|
|
<case> ::= <binding_pattern> Aro <expr>
|
|
|
|
<rank1_expr> ::= <rank2_expr> { <rank1_op> <rank2_expr> }
|
|
<rank2_expr> ::= <rank3_expr> { <rank2_op> <rank3_expr> }
|
|
<rank3_expr> ::= <rank4_expr> { <rank3_op> <rank4_expr> }
|
|
<rank4_expr> ::= <rank5_expr> { <rank5_expr> }
|
|
<rank5_expr> ::= <rank6_expr> { <rank5_op> <rank6_expr> }
|
|
<rank6_expr> ::= <rank7_expr> { <rank6_op> <rank7_expr> }
|
|
<rank7_expr> ::= <tightexpr> { <rank7_op> <tightexpr> }
|
|
<rank1_op> ::= LOr | VBar
|
|
<rank2_op> ::= LAnd | Aro
|
|
<rank3_op> ::= Eq | NEq | LessThan | GreaterThan
|
|
<rank5_op> ::= Range
|
|
<rank6_op> ::= Add | Sub
|
|
<rank7_op> ::= Mult | Div | Mod
|
|
|
|
<binding_pattern> ::= Symbol { <tight_binding_pattern> }
|
|
<tight_binding_pattern> ::= Literal
|
|
| Symbol
|
|
| OpenParen <binding_pattern> CloseParen
|