Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Identifiers and Keywords

Grammar

name         ::= letter constituent* | "_" constituent*
constituent  ::= letter | digit | "_" | "'"
quals        ::= (name ".")+
qualname     ::= name | quals name
symbol       ::= symstartchar symchar*
qualsymbol   ::= symbol | quals symbol | "`" qualname "`"
fieldid      ::= decimal | name
symstartchar ::= "+" | "-" | "*" | "/" | "%" | "=" | "!" | ">" | "<" | "|" | "&" | "^"
symchar      ::= symstartchar | "."
constructor  ::= "#" name

Description

A name is an unqualified identifier used at definition sites. A qualname is the dotted form used to reference something inside a module. A symbol (or qualsymbol) names an operator.

Constructor names of sum types are identifiers prefixed with #, with no whitespace between the # and the name. Record fields use fieldid, which is either a name or a decimal.

Wyn has three distinct namespaces:

  • Terms: variables, functions, and modules.
  • Module types: module type definitions.
  • Types: type names and type constructors.

Modules (including parameterized modules) and values share the term namespace.

Reserved Names

Reserved names and symbols may appear only where the grammar explicitly admits them; they cannot be bound in definitions.

Reserved identifiers:

case, def, do, else, entry, extern, false, for, functor, if,
import, in, include, let, loop, match, module, open, sig, then,
true, type, while, with

Reserved symbols:

=    ->    |    |>