About this document
Note: The experimental features of Nim are covered .
Note: Assignments, moves and destruction are specified in the destructors document.
To learn how to compile Nim programs and generate documentation see and DocGen Tools Guide.
The language constructs are explained using an extended BNF, in which (a)* means 0 or more a’s, a+ means 1 or more a’s, and (a)? means an optional a. Parentheses may be used to group elements.
The |, / symbols are used to mark alternatives and have the lowest precedence. / is the ordered choice that requires the parser to try the alternatives in the given order. / is often used to ensure the grammar is not ambiguous.
Non-terminals start with a lowercase letter, abstract terminal symbols are in UPPERCASE. Verbatim terminal symbols (including keywords) are quoted with ‘. An example:
Other parts of Nim, like scoping rules or runtime semantics, are described informally.