Nex

Specification

The Nex language reference — lexical syntax through standard prelude, plus deferred features and naming conventions.

The Nex language reference. Each chapter covers one major area — lexical structure, the type system, expressions, bindings, functions, control flow, the mode system and memory management, modules, the standard prelude, and what’s deferred to later language versions.

All code in this reference is valid against the current implementation. Built-in functions (sqrt, sum, map, …) and constants (pi, e, i, …) come from the implicit prelude described in chapter 10.

Pages

  • Introduction — What Nex is, who it's for, what's in scope and what's deferred.
  • Lexical Syntax — Source encoding, identifiers, keywords, literals, comments, indentation, and statement separators.
  • Type System — Primitive types, numeric promotion, arrays, tuples, structs, sum types, function types.
  • Expressions — Operators and precedence, arithmetic, element-wise arrays, comparison, conditionals, lambdas, ranges, array literals and slicing, structs, tuples, blocks.
  • Bindings — const, val, and var — what they bind, when they're evaluated, scoping and shadowing.
  • Functions — Declarations, return types, parameters, modes, closures, higher-order functions, recursion, early return, test functions.
  • Control Flow — if / else, for, while, match, block scoping.
  • Mode System and Memory Management — The two array regimes, uniqueness for var arrays, auto-clone, read-mode parameters, ARC, future RAII.
  • Modules — Folder-as-module, declaration, imports, visibility, no .mod headers, test modules.
  • Standard Library / Prelude — Constants, scalar math, complex operations, rank-1 and rank-2 array operations, construction, I/O, conversions, assertions.
  • Deferred — Features intentionally excluded from the current language, split into near-term additions and long-term work.
  • Appendix A: Naming Conventions — Recommended (but not enforced) conventions for modules, types, functions, and constants.
  • Appendix B: Open Design Questions — Small items not yet pinned to a single answer in the reference.

Search

Esc
to navigate to open Esc to close