| topdec | ::= | valbind | value |
| | type datbind | custom type |
| | type alias typbind | type alias |
| | port var : ty | port |
| | topdec1 ; topdec2 | sequential |
| | topdec1 ⋯ topdecn | module body (n≥2)† |
| datbind | ::= | tycon tyvarseq = conbind | custom-type binding |
| | ⟨and datbind⟩ | |
| conbind | ::= | con ty1 ⋯ tyn ⟨| conbind⟩ | constructor binding |
| | | (n≥0) |
| typbind | ::= | tycon tyvarseq = ty | type-alias binding |
| tyvarseq | ::= | tyvar1 ⋯ tyvark | type parameters |
| | | (k≥0) |