|
|
@ -5,11 +5,14 @@ block_line = _{ expr | (statement ~ MLF)* }
|
|
|
|
statement = { (decl | type_decl | expr) ~ TERMINATE }
|
|
|
|
statement = { (decl | type_decl | expr) ~ TERMINATE }
|
|
|
|
decl = { "let" ~ #name = ident ~ #args = (ident)* ~ "=" ~ expr }
|
|
|
|
decl = { "let" ~ #name = ident ~ #args = (ident)* ~ "=" ~ expr }
|
|
|
|
|
|
|
|
|
|
|
|
type_decl = { "type" ~ #name = type_ident ~ "=" ~ type_expr }
|
|
|
|
type_decl = { "type" ~ #name = type_ident ~ "=" ~ type_expr }
|
|
|
|
type_expr = { tuple | type_ident }
|
|
|
|
type_expr = { tuple | rec | type_ident }
|
|
|
|
tuple = { "#(" ~ type_expr* ~ ")" }
|
|
|
|
tuple = { "#(" ~ MLF ~ tuple_entry* ~ MLF ~ ")" }
|
|
|
|
type_ident = ${ #name = ident ~ #args = type_args? }
|
|
|
|
tuple_entry = _{ type_expr ~ MLF }
|
|
|
|
type_args = { "<" ~ type_ident* ~ ">" }
|
|
|
|
rec = { "#{" ~ MLF ~ (rec_field ~ TERMINATE ~ MLF)* ~ rec_field? ~ MLF ~ "}" }
|
|
|
|
|
|
|
|
rec_field = { #field_name = ident ~ ":" ~ #field_type = type_expr* }
|
|
|
|
|
|
|
|
type_ident = ${ #name = ident ~ #args = type_args? }
|
|
|
|
|
|
|
|
type_args = { "<" ~ MLF ~ type_ident* ~ MLF ~ ">" }
|
|
|
|
|
|
|
|
|
|
|
|
expr = { infix_expr | call_expr | term }
|
|
|
|
expr = { infix_expr | call_expr | term }
|
|
|
|
term = _{ ident | literal | "(" ~ MLF ~ expr ~ MLF ~ ")" | block }
|
|
|
|
term = _{ ident | literal | "(" ~ MLF ~ expr ~ MLF ~ ")" | block }
|
|
|
|