The Neper language in brief

This page condenses the essentials. The normative references are docs/grammar.ebnf (revision 3), docs/llm-neper-card.md (the editing card this page is derived from), docs/spec.md and docs/module-apis.md (the standard library index).

Program shape

use e.io

fn main(a: *mem.Arena, args: []str) -> err {
    try io.print("Hello, Neper")
    ret ok
}

A program is a run of declarations: use, const, var, error, type, fn and extern. Modules are named by dotted paths (e.io, e.algo.graph) and imported with use.

Bindings and types

Errors, try and defer

Structs, enums and unions

Comptime and generics

fn largest[T: type](xs: []const T) -> T { ... }

Type parameters are written [T: type]; functions and types with compile-time arguments are monomorphised. Modules expose generic helpers (e.g. channel.send[i64]), and comptime parameters carry array lengths and flags.

No-shadowing, and reserved words

A local may not reuse a module-scope function, type or module name (the E-NAME-0003 diagnostic). The full keyword list is in the editing card: as break case const continue default defer else enum error extern false fn for if in isize let nil nocheck ok own resource ret shared struct switch true try type undef union unreachable use usize var when while zero.

Standard library

Everything is in modules under e.: e.io, e.mem, e.str, e.net.http, e.game, e.ui, e.chart, e.algo.*, e.math.* and more. The complete index is docs/module-apis.md; the machine-readable summary is llms.txt.

Next

Install Neper, then read the get-started walkthrough and the measured blog posts.