Skip to content

Releases

Nihil v4.20.0

Choose a tag to compare

@github-actions github-actions released this 29 Nov 14:43
eba21d5

A program can read its command line. argv() in std:env.nihil gives the arguments it was started with, so a
tool with options no longer needs a wrapper in another language to turn them into input.

  • argv() in std:env.nihil: the arguments the program was started with, after its own name, as [STRING]
    (./prog a "b c" "" gives ["a", "b c", ""]; nihil run prog.nihil a b passes a and b). Linux reads
    /proc/self/cmdline, as env reads /proc/self/environ; on macOS the runtime gives that file from _NSGetArgv.
    The test suite passes the lines of NAME.args as arguments (tests/run.sh, macos/test-native-c.sh,
    linux-arm64/test.sh); tests/stage1/std_argv checks an empty argument, spaces and UTF-8
    • Why: a program could not read its command line, so a tool with options needed a second program in another
      language (a CLI in Python, for a simulation engine written in Nihil) only to turn them into input. The name is
      argv, not args: args is a parameter in std:mcp.nihil and in programs, and would collide

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux on x86_64 and on ARM64 (with binutils), and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil v4.19.0

Choose a tag to compare

@github-actions github-actions released this 29 Nov 03:34
814471c

A new library and a fix for macOS. std:math.nihil brings sqrt and ln on FLOAT, and isqrt, mulmod,
powmod and is_prime on INT. On a Mac, path.list() gave an empty list after about 250 listings (each one left a
file descriptor open), and the IDE then showed every project empty.

  • std:math.nihil, numbers the library did not have: sqrt(x) (correctly rounded) and ln(x) (within 2 ulp)
    on FLOAT, with nan, inf and 0 handled; and on INT isqrt(n), mulmod(a, b, n), powmod(b, e, n) and
    is_prime(n), a deterministic Miller-Rabin with the first 12 prime bases, exact for every INT. mulmod and
    powmod never overflow: past 2^31.5 they build the 128-bit product from 32-bit halves (Montgomery
    multiplication for odd moduli, doubling otherwise). Checked against Python on 318,000 square roots (all equal),
    1,000 logarithms and 18,000 integer cases; tests/stage1/std_math

    • Why: a study of prime numbers written in Nihil carried its own ln and Montgomery code, and its first
      version of ln lost 10 ulp just below 1; numbers belong in the standard library, written and checked once
  • macOS: path.list() no longer runs out of file descriptors. The runtime reads a directory through a DIR opened
    on a copy of its descriptor, and closing it closed only the copy: after about 250 listings list() gave an empty
    list, and the IDE showed every project empty after a few minutes of use. The table of directories being read also
    grows from 256 descriptors to 4096 (Linux reads directories with its own call and never had it)

    • Why: a long-running program that lists directories (the IDE's server polls the project's files) stopped seeing
      any file

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux on x86_64 and on ARM64 (with binutils), and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil v4.18.1

Choose a tag to compare

@github-actions github-actions released this 29 Nov 01:24
bc29d94

The documents only: new examples in the specification and the tests (a BUDGET and its PRODUCTs, orders and
sales), and plainer notes for past versions. No code changes; the packages are v4.18.0's but for the documents
they carry.

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux on x86_64 and on ARM64 (with binutils), and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil nightly (eba21d5)

Pre-release

Choose a tag to compare

@github-actions github-actions released this 23 Nov 13:49
eba21d5

The newest build of main: commit eba21d5 (2026-11-29 14:42 UTC). It is not a release and may break; the releases are the versions vX.Y.Z.

curl -fsSL https://nihil-lang.dev/install.sh | NIHIL_VERSION=nightly sh

Linux on x86_64 and on ARM64 (with binutils), and macOS on Apple silicon (with the Xcode Command Line Tools). curl -fsSL https://nihil-lang.dev/install.sh | sh goes back to the latest release.

Nihil v4.18.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 23:08
83966d9

Records take 8 bytes less: their header is one word instead of two. bench/workload (1,000,000 sales, an M4) peaks
at 140 MB instead of 156, in the same time and with the same files; on Linux x86-64, where a record of five INT
fields is 48 bytes instead of 64, from 167 to 137 MB. A real program whose memory goes mostly to texts and maps (a
planogram generator, about 800 MB on Linux) peaks the same, with the same output. No program changes.

  • Records take 8 bytes less: a header of one word instead of two (no length word; SPEC §20.12). A record of five
    INT fields is 48 bytes instead of 64 on Linux x86-64 and 48 instead of 56 on ARM64. bench/workload (1,000,000
    sales, an M4): peak memory 156 → 140 MB, the same time and the same files. Both collectors scan a block from its
    second word, so a record's first field is seen; an ARRAY's length word, scanned too, is no address

    • Why: a record's length word was read by nothing once the prelude went through the record contract (v4.18's
      first part): two million records of the workload carried 16 MB of it
  • Records have a contract of their own, apart from ARRAY's: the prelude makes a record in one place
    (__nihil_rec_new) and reads a field with __nihil_rec_get(r, i), an ARRAY's load without the limit (a record's
    length word is no longer read by anything), and the compiler finds a record's header word at one offset
    (REC_FLAGS). No program changes; bench/workload the same (139 ms). The groundwork for records with a header of
    8 bytes instead of 16

    • Why: the prelude read and wrote a record's fields as an ARRAY's elements, which checked each index against
      the length word before the record: that word could not go

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux on x86_64 and on ARM64 (with binutils), and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil v4.17.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 22:07
bdf8ac8

Nihil runs on Linux on ARM64 (Graviton and other ARM servers, 64-bit boards), with static executables that need no
C library: a third package, nihil-linux-arm64, checked on GitHub's ARM64 runners like the other two. A LIST of
records is written as a table without a copy (bench/workload: 8 MB less at its peak), and Nihil installs with
Homebrew (brew install nihillang/tap/nihil).

  • Linux on ARM64: -native-linux writes a program as ARM64 assembly for Linux with its whole runtime, which as
    and ld (binutils) make into a static executable with no C library. The ARM64 backend of macOS, with ELF's
    syntax, a layer of the system of its own (src1/native_linux.nihil: Linux's calls on x86-64, which the prelude
    speaks, made with ARM64's) and the 25 C functions its runtime calls written over Linux's calls (src1/nhlibc.c).
    The compiler built there compiles itself to the same text the Mac's writes for it; the tests pass as usual,
    without optimizations and with the collector under pressure. A new package, nihil-linux-arm64, built and
    checked on GitHub's ARM64 runners (linux-arm64/ci.sh, in tests.yml and the release workflow); install.sh
    installs it. bench/workload (1,000,000 sales, Linux in a container on an M4): about 145 ms, the same results
    as on the Mac. See docs/linux-arm64.md

    • Why: ARM servers (Graviton) and boards run Linux on ARM64; the backend existed, only the system around it
      was macOS's
    • The macOS layer of the runtime moved to src1/native_mac.nihil, unchanged
  • Install with Homebrew: brew install nihillang/tap/nihil (the tap github.com/nihillang/homebrew-tap; its formula
    is written from each release's checksums by dist/brew-formula.sh). install.sh no longer asks for objdump on
    macOS, which only the translator needed

  • Tables: @>> path, list; writes a LIST of records straight from its items, the same file and the same errors as
    @>> path, list.array();, without copying them into an ARRAY first. bench/workload writes its sales that way:
    peak memory 165 → 157 MB at 1,000,000 sales, about 1% fewer cycles (an M4)

    • Why: .array() made a second ARRAY of a million pointers only to hand it to the writer, and a LIST was refused
      with a message that did not say why

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux on x86_64 and on ARM64 (with binutils), and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil v4.16.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 20:17
2fa804e

macOS is native only: the translator of the x86-64 code to ARM64 and its C runtime leave, as announced in
v4.13. Programs, and the compiler itself, are compiled straight into ARM64, as nihil has done by default since
v4.13; no program changes, and the package is smaller (634 KB, from 701 KB). Contributing gets issue forms, a pull
request checklist and the Developer Certificate of Origin.

  • macOS: the translator of the x86-64 code to ARM64 (NIHIL_TRANSLATE=1, macos/translate.nihil) and its C runtime
    (arm64/rt.c) are gone, as announced: every program, and the compiler itself, is compiled straight into ARM64
    (-native), the way nihil has worked by default since v4.13. NIHIL_TRANSLATE=1 now prints a note and compiles
    the native way. The release workflow builds the Mac's compiler from the latest release's native compiler
    (macos/ci-native.sh) instead of translating the Linux one, and still checks that it emits the same x86-64 bytes;
    macos/dev.sh and macos/same-bytes.sh build the compiler natively. The package is smaller: no translate, no rt.o

  • Contributing: issue forms (a bug report, a proposal), a pull request checklist, and the Developer Certificate of
    Origin: each commit of a pull request is signed off (git commit -s), checked by the dco workflow

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux x86_64, and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil v4.15.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 15:23
3446410

Tables are read and written several fields at once, maps and sorting take fewer calls, a division by a constant becomes
a multiplication, and on a Mac a program of more than 1 MiB of code is assembled. bench/workload (1,000,000 sales, an
M4, the release packages one after the other) went from 175 to 139 ms: 0.9 times C (151 ms) and 0.5 times Go (263 ms);
from v4.12, 286 ms, it is twice as fast. The same program's peak memory went from 149 to 157 MB. In a real program
(a planogram generator of about 1 GB), the gain is 1 to 3%: its time goes elsewhere. The ARM64 backend is now checked
on every push and pull request (macos/ci-native.sh). The translator of the x86-64 code (NIHIL_TRANSLATE=1) stays
until v4.16.

  • macOS: every push and pull request builds the compiler straight into ARM64 from the latest release's, checks its
    fixed point and runs the tests as usual, without optimizations and with the collector under pressure
    (macos/ci-native.sh, the macos-native job of tests.yml)

    • Why: Until now only the release workflow ran the ARM64 checks: a change could break the Mac's backend and be
      seen only at the next release
  • Tables: writing a record takes its usual fields (INT from 0 to 10^8 − 1, BOOL, STRING that fits) in a function that
    calls nothing, so its values stay in registers, and the rest (FLOAT, a field that does not fit) goes on from the
    first such field as before; reading one, the table calls the native parse straight away, one call a record
    instead of three; the same bytes and the same errors

    • Why: The error messages made the whole of rec_put call other functions, so every field's type, width and value
      went through memory. bench/workload's table, 1,000,000 sales, on an M4 with -native: written 43 → 39 ms,
      read 37 → 35.5 ms; 5% fewer instructions for the whole run
  • -native (macOS): a program of more than about 1 MiB of code is assembled (its conditional jumps that do not reach their target, 1 MiB at most, become the opposite jump over a plain b); a comparison with a small constant takes its immediate form (cmp x24, #0, cmn x0, #1)

    • Why: The error stubs and the runtime's routines sit at the program's end: in a larger program, clang stopped with
      "fixup value out of range" (a top level of 6,500 lines had 151 such jumps). Smaller programs come out the same
  • Writing a record (@>> path, rows, $r): an INT field of up to 8 digits, not negative, is made with no loop per
    digit (4 + 4, 2 + 2, 1 + 1 by multiplications, the zeros before the first digit turned into spaces at once) and each
    byte of the field written once, instead of spaces first, then a loop to count the digits and another to write
    them; the same bytes and the same errors

    • Why: How many digits a number has changes from record to record, so those loops' exits were mispredicted
      several times a record. bench/workload's table written from 1,000,000 sales: 56 → 45 ms on an M4 with -native
      (−6% cycles for the whole program, though 3% more instructions)
  • -native (macOS): reading a table, an INT field of up to 8 bytes, right-aligned, is read in one go (its 8 bytes at
    once: blanks and digits by masks, the value by three multiplications) instead of a byte at a time, and the record is
    taken from the allocation run without zeroing it first (every word is written right after)

    • Why: The byte loops miss their branch prediction once a field (the blanks and digits change from row to row).
      bench/workload's whole run, 1,000,000 sales: 634 → 598 M cycles on an M4
  • sort(key) copies the keys once, each beside its element's index, merges those pairs (one loop per kind of key)
    and starts from runs of 8 sorted by insertion: 1,000,000 records sorted 30% faster by an INT key (97 → 68 ms on an
    M4) and 26% by a STRING key (273 → 203 ms); the same stable order.

  • maps: m[k] = (m[k] || d) + e; with a STRING key finds its slot inside the one call (the hash and the look-up
    written out, the same slots as before) instead of calling the look-up, which called the hash

    • Why: Three calls a sale became one. bench/workload's units by product name over 1,000,000 sales: 16 → 13 ms on
      an M4 with -native; the map phase 38 → 35 ms
  • On a Mac (-native), a division or rest by a constant that is not a power of 2 becomes a multiplication
    (smulh, Granlund and Montgomery: the smallest multiplier that fits, loaded once before the loop), and writing a
    number in decimal takes one division per digit, not two: a chain of x / 10 and x % 10 35% faster (0.20 → 0.13
    s on an M4), bench/workload's JSON phase 11 → 10 ms.

  • -native (macOS): v[] = x, v[i] and v[i] = x on a LIST are done in place when the list has room or the index is
    within it, calling the prelude only to grow the list or to report the index; an allocation takes the next block of
    a run of free ones instead of looking for one each time

    • Why: A push went from about 66 to 12 instructions. bench/workload's price dispatch
      (rules[s.product % 4].total(...)) over 1,000,000 rows: 6 → 4 ms on an M4. The make-up phase keeps its time: it
      is bound by fresh memory and the collector, not by instructions

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux x86_64, and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil v4.14.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 02:14
f7d6e35

On a Mac, the native collector does less work and wastes less memory; maps add to a key in one call; and writing a table
no longer makes its whole text first. bench/workload (1,000,000 sales) went from 205 to 171 ms on an M4 (1.2 times C,
0.6 times Go), and its peak memory from 176 to 149 MB. The translator of the x86-64 code (NIHIL_TRANSLATE=1) stays one
more version.

  • maps: m[k] = (m[k] || d) + e; on a map of INT values is one call that finds the slot once and adds in place
    (docs/map-upsert.md), where it was a read and a write; d an INT literal, e names, numbers, fields, indexes and
    arithmetic with no call, so nothing can tell the two apart but the time. Off with -O0
    • Why: The commonest update of a map, a count or a total by key. bench/workload's map phase on an M4: 43 → 38 ms
      with -native
  • @>> path, rows; writes the table about 1 MB at a time instead of making its whole text first (SPEC §20), on Linux
    and on macOS: the same file, written the same way (a temporary, synced and renamed), and the same errors, with the
    file left untouched when a field does not fit
    • Why: 1,000,000 records make a 21 MB text that was garbage as soon as it was written. A program whose peak is the
      write (a million records, then @>>) goes from 101 to 81 MB on an M4. bench/workload keeps its peak, which is
      later (the sales and the rows read back, both alive)
  • macOS: the native collector does not look inside a record whose fields are all INT, FLOAT or BOOL (made by its
    model or read from a table; not yet those the prelude makes, such as [r ; n] and from_json): no address can be
    in it
    • Why: bench/workload's million sales are such records: its table phase went from 124 to 114 ms and generate from
      25 to 23 ms on an M4
  • macOS: the native collector has 41 block sizes instead of 21 (32, 40, 48, 56, 64, 80 … 32768: four to a doubling),
    so a block wastes at most a fifth of itself instead of a third
    • Why: A record of five fields takes 56 bytes and was given 64. bench/workload (1,000,000 sales, two copies of
      them) peaks at 159 MB instead of 176, with 2% fewer instructions and the same time
  • macOS: the native collector marks a small block it does not look inside (a text, a record of numbers only) without
    putting it on its stack of blocks to scan
    • Why: It was put there and taken off again to no purpose, a million times a collection in bench/workload.
      Marking 1,000,000 such records takes a half to a third of the time; the workload runs 5% fewer instructions
      (generate 22 → 19 ms) and peaks at 149 MB instead of 159 (the stack no longer grows to a million entries)
  • fix: macOS -native: closing a descriptor (__nihil_syscall([3, fd])) gives the system's answer (0 or -errno,
    Linux's numbers) instead of always 0, as on Linux; a directory's descriptor is closed once, by its closedir

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux x86_64, and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.

Nihil v4.13.0

Choose a tag to compare

@github-actions github-actions released this 27 Nov 21:25
cf183a9

On a Mac the compiler now writes ARM64 itself, with no translator; maps, division and the ARM64 code get faster; and
the macOS package starts on macOS 11 again. bench/workload (1,000,000 sales) went from 282 to 205 ms on an M4
(1.4 times C, 0.8 times Go); on Linux, its map phase from 96 to 70 ms.

  • macOS: nihil compiles every program with -native (docs/macos-arm64.md): the compiler writes the whole program as ARM64 assembly, its runtime included (written in Nihil), and clang links it with the system's library alone. The package's compiler is built the same way and compiles itself to the same assembly. NIHIL_TRANSLATE=1 keeps the translator of the x86-64 code for this version; the next one removes it, with arm64/rt.c
    • Why: The direct way is faster than the translated one and is one way to keep instead of two (every optimization had to be made and tested for both). The ARM64 session checked the whole suite gives the same output, error text and exit code both ways; the 16 Learn chapters, the IDE and an MCP server were checked on an installed package
  • fix: the macOS package starts on macOS 11 and later. Its binaries carried the version of the machine that built them (v4.12.0's need macOS 26), so older Macs refused to start the compiler; programs nihil builds carry 11.0 too. The release workflow now checks it
    • Why: clang stamps the build machine's macOS as the minimum unless told otherwise; found while making -native the default
  • maps: m[k] = (m[k] || 0) + v looks the key up once (the map keeps the slot its last read looked at, and a write takes it only when that slot holds the same key); an INT key's look-up makes no call inside, and its hash is written out; the used table takes a byte a slot instead of eight (17 bytes a slot, not 24). bench/workload's map phase: 96 → 70 ms on Linux (i3-1115G4), 80 → 42 ms on an M4 (with the ARM64 changes below)
    • Why: Maps were the largest gap after making records: every such update made six calls and looked the key up twice
  • x86-64: a division or rest by a constant power of 2 (up to 2^31) is shifts, rounding towards 0 as before, instead of a call to idiv
    • Why: x / 16, x % 256 and a random generator's % 2^31 are common; idiv costs tens of cycles (less on recent Intel: bench/workload's generate went 81 → 76 ms on an i3-1115G4)
  • ARM64 (-native): pushes and pops in pairs (stp/ldp), constants negated or shifted at compile time, and no reload of a global just stored. bench/workload on an M4: 221 → 208 ms

Install

curl -fsSL https://nihil-lang.dev/install.sh | sh

Linux x86_64, and macOS on Apple silicon (with the Xcode Command Line Tools).

Each package has a build provenance attestation: gh attestation verify nihil-linux-x86_64.tar.gz --repo nihillang/nihil.