Documentation

(*
tokens:

Module "module"
Imports "imports"
Exports "exports"
As "as"
Dot "."
Comma ","
ParenOpen "("
ParenClose ")"
BraceOpen "{"
BraceClose "}"
At "@"
Equal "="
Arrow "->"

*)

module =
  module_spec
  item*
  EOF
  ;


module_spec =
  "module" ident
  ;

import =
  | ident ("as" ident)?
  | ident "." import
  | "{" list{import} "}"
  ;

exports =
  "exports" export_list
  ;

export_list =
  | ident
  | "(" list{ident} ")"
  ;

item =
  | attr* type_decl
  | decl
  ;

attr =
  | "@" ident
  | "@" ident "(" .* ")"
  ;

type_decl =
  "type" ident "=" type
  ;

type =
  type_fn
  ;

type_fn =
  type_app ("->" type_app)?
  ;

type_app =
  ident (ident | type_)
  ;

type_group =
  "("  ")"
  ;

decl =
  TODO
  ;

ident =
  regex{"[a-zA-Z_][a-zA-Z_0-9]*"}
  ;

list{item} = item ("," item)+ ","? ;
regex{...} = ...