|
|
@ -6,11 +6,17 @@ 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 | rec | type_ident }
|
|
|
|
type_expr = { tuple | rec | enum | type_ident }
|
|
|
|
|
|
|
|
|
|
|
|
tuple = { "#(" ~ MLF ~ tuple_entry* ~ MLF ~ ")" }
|
|
|
|
tuple = { "#(" ~ MLF ~ tuple_entry* ~ MLF ~ ")" }
|
|
|
|
tuple_entry = _{ type_expr ~ MLF }
|
|
|
|
tuple_entry = _{ type_expr ~ MLF }
|
|
|
|
|
|
|
|
|
|
|
|
rec = { "#{" ~ MLF ~ (rec_field ~ TERMINATE ~ MLF)* ~ rec_field? ~ MLF ~ "}" }
|
|
|
|
rec = { "#{" ~ MLF ~ (rec_field ~ TERMINATE ~ MLF)* ~ rec_field? ~ MLF ~ "}" }
|
|
|
|
rec_field = { #field_name = ident ~ ":" ~ #field_type = type_expr* }
|
|
|
|
rec_field = { #field_name = ident ~ ":" ~ #field_type = type_expr* }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum = { "#[" ~ (enum_vrt ~ TERMINATE ~ MLF)* ~ enum_vrt? ~ "]" }
|
|
|
|
|
|
|
|
enum_vrt = { #vrt_name = ident ~ type_expr }
|
|
|
|
|
|
|
|
|
|
|
|
type_ident = ${ #name = ident ~ #args = type_args? }
|
|
|
|
type_ident = ${ #name = ident ~ #args = type_args? }
|
|
|
|
type_args = { "<" ~ MLF ~ type_ident* ~ MLF ~ ">" }
|
|
|
|
type_args = { "<" ~ MLF ~ type_ident* ~ MLF ~ ">" }
|
|
|
|
|
|
|
|
|
|
|
|