2022-03-11 01:28:55 +00:00
|
|
|
<program> ::= { DeclarationStart <declaration> }
|
|
|
|
|
2022-04-06 13:23:46 +00:00
|
|
|
<declaration> ::= Type Symbol { <typearg> } Assign <variant_decl> { VBar <variant_decl> }
|
|
|
|
| Struct Symbol { <typearg> } Assign { <def_field> }
|
|
|
|
| Trait Symbol { <typearg> } [ On <composite_type> ] Needs { <def_field> }
|
|
|
|
| Impl Symbol [ <typearg> ] On <composite_type> Colon <impl> { <impl> }
|
2022-03-11 01:28:55 +00:00
|
|
|
| Symbol <def>
|
|
|
|
|
|
|
|
<variant_declaration> ::= Symbol { <grouped_type> }
|
|
|
|
|
|
|
|
<full_type> ::= <composite_type> [ { Comma <composite_type> } Aro <full_type> ]
|
|
|
|
|
|
|
|
<composite_type> ::= <simple_type> { <grouped_type> }
|
|
|
|
|
|
|
|
<grouped_type> ::= <simple_type>
|
|
|
|
| OpenParen <full_type> CloseParen
|
|
|
|
|
2022-04-06 13:23:46 +00:00
|
|
|
<simple_type> ::= Symbol [ OpenSquareBracket <expr> CloseSquareBracket ]
|
2022-03-11 01:28:55 +00:00
|
|
|
|
|
|
|
<def_field> ::= Dot Symbol Colon <full_type>
|
|
|
|
|
2022-04-06 13:23:46 +00:00
|
|
|
<typearg> ::= Symbol [OpenSquareBracket <full_type> { Comma <full_type> } CloseSquareBracket]
|
2022-03-11 01:28:55 +00:00
|
|
|
|
|
|
|
<impl> ::= Dot Symbol { Symbol } Assign <expr>
|
|
|
|
|
|
|
|
<def> ::= Colon <full_type>
|
|
|
|
| { Symbol } Assign <expr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-06 13:23:46 +00:00
|
|
|
<expr> ::= If <expr> <ifblock>
|
2022-03-11 01:28:55 +00:00
|
|
|
| <let> { <let> } In <expr>
|
|
|
|
| <infix_expr>
|
|
|
|
<tightexpr> ::= Literal
|
|
|
|
| { <multisymbol> }
|
|
|
|
| OpenParen <expr> CloseParen
|
|
|
|
|
|
|
|
<multisymbol> ::= Symbol { Dot Symbol }
|
|
|
|
|
|
|
|
<let> ::= Let Symbol Assign <expr>
|
|
|
|
|
|
|
|
<ifblock> ::= Is <case> { Comma <case> } [ Comma ]
|
|
|
|
| Then <expr> Else <expr>
|
|
|
|
|
|
|
|
<case> ::= <binding_pattern> Aro <expr>
|
|
|
|
|
|
|
|
|
2022-04-06 13:23:46 +00:00
|
|
|
<infix_rank1_expr> ::= <infix_rank2_expr> [ <infix_rank1_op> <infix_rank1_expr> ]
|
|
|
|
<infix_rank2_expr> ::= <infix_rank3_expr> [ <infix_rank2_op> <infix_rank2_expr> ]
|
|
|
|
<infix_rank3_expr> ::= <infix_rank4_expr> [ <infix_rank3_op> <infix_rank3_expr> ]
|
|
|
|
<infix_rank4_expr> ::= <infix_rank5_expr> [ <infix_rank4_op> <infix_rank4_expr> ]
|
|
|
|
<infix_rank5_expr> ::= <call_or_access> [ <infix_rank5_op> <infix_rank5_expr> ]
|
2022-03-11 01:28:55 +00:00
|
|
|
<infix_rank1_op> ::= Mult | Div | Mod
|
|
|
|
<infix_rank2_op> ::= Add | Sub
|
2022-04-06 13:23:46 +00:00
|
|
|
<infix_rank3_op> ::= Range
|
|
|
|
<infix_rank4_op> ::= Eq | NEq | LessThan | GreaterThan
|
|
|
|
<infix_rank5_op> ::= LAnd
|
|
|
|
<infix_rank6_op> ::= LOr
|
|
|
|
<call_or_access> ::= <tightexpr> { <tightexpr> }
|
2022-03-11 01:28:55 +00:00
|
|
|
|
|
|
|
<binding_pattern> ::= Symbol <bp_innards>
|
|
|
|
| Literal
|
2022-04-06 13:23:46 +00:00
|
|
|
<bp_innards> ::= <bp_field> { <bp_field> }
|
|
|
|
| { <binding_pattern> }
|
2022-03-11 01:28:55 +00:00
|
|
|
<bp_field> ::= Dot Symbol Assign <binding_pattern>
|