Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
test:
name: Port specs + kernel certification (LuaJIT)
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

Expand All @@ -36,7 +36,7 @@ jobs:

coverage:
name: Coverage (best-effort)
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
continue-on-error: true
steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@ Notable changes to shen-lua. Release notes for earlier versions are under

## [Unreleased]

## [0.12.0] - 2026-11-05

### Changed

- **Kernel: ShenOSKernel 43.2** (community `Shen-Language/shen-sources`, tag
`shen-43.2`, commit `e6947f507ebc`, release tarball SHA-256
`23c71508...417f32`). Vendored byte-identical; `(version)` is `"43.2"`. Against
the previously vendored 43.1 build at `ec16a9f` only `init.kl` (the version
string) and `extension-type-annotations.kl` (renumbered generated names) change;
`t-star.kl` is unchanged, so the native typechecker fingerprints and the eqterm
path in `shen.by-hypothesis-h` are unaffected. `tests/` gains upstream's
`benchmark-coverage.shen`. `bin/yggdrasil-build.lua` now expects manifest
`kernel-version=43.2`.

- **Kernel: ShenOSKernel 43.1 at upstream `ec16a9f`** (the 43.1 release plus
shen-sources#117): `shen.by-hypothesis` and `shen.search-user-datatypes`
dereference the checked term once per call through new `-h` predicates, and
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# shen-lua

[Shen](https://shenlanguage.org) on **LuaJIT 2.1**: pattern matching, optional
sequent types, and Prolog, compiled to Lua. ShenOSKernel 43.1, **154/154**
sequent types, and Prolog, compiled to Lua. ShenOSKernel 43.2, **154/154**
official kernel tests. Embeds in any Lua host. Plain Lua 5.1/5.4/5.5 works too (slower,
still correct).

Expand Down Expand Up @@ -147,7 +147,7 @@ More under [`examples/`](examples/README.md). A full tour:

```sh
make test # port specs (test/*_spec.lua)
luajit run-kernel-tests.lua # official 43.1 suite → 154/154
luajit run-kernel-tests.lua # official 43.2 suite → 154/154
```

The kernel suite is vendored in `tests/`. Port specs cover primitives, REPL,
Expand All @@ -160,8 +160,8 @@ luarocks install shen # launcher + modules
luarocks make --local shen-scm-1.rockspec # this tree
```

LuaJIT required (`lua == 5.1`). This tree uses ShenOSKernel **43.1**; release
**0.11.1** uses Tarver's S42 kernel; **0.9.0** was 41.1. Or grab `shen-bundle.lua` from
LuaJIT required (`lua == 5.1`). This tree uses ShenOSKernel **43.2**; release
**0.12.0** is the first on the community 43.2 kernel, **0.11.1** uses Tarver's S42 kernel; **0.9.0** was 41.1. Or grab `shen-bundle.lua` from
[Releases](https://github.com/pyrex41/shen-lua/releases/latest) — one file,
`require("shen-bundle")`.

Expand Down
4 changes: 2 additions & 2 deletions bin/yggdrasil-build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ end
assert(man.kernel, MANIFEST .. ": missing kernel=")
assert(man.init, MANIFEST .. ": missing init=")
assert(#man.user > 0, MANIFEST .. ": no user= entries")
if man["kernel-version"] ~= "42.2" then
io.stderr:write(("yggdrasil-build: warning: manifest kernel-version=%s, this port is certified against 42.2\n")
if man["kernel-version"] ~= "43.2" then
io.stderr:write(("yggdrasil-build: warning: manifest kernel-version=%s, this port is certified against 43.2\n")
:format(tostring(man["kernel-version"])))
end

Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ local function find_kldir()
end
local KLDIR = find_kldir() .. "/"
P.KLDIR = KLDIR -- resolved .kl directory (trailing /), for typecheck_native
-- Boot order for the ShenOSKernel-43.1 kernel (community shen-sources line).
-- Boot order for the ShenOSKernel-43.2 kernel (community shen-sources line).
-- Every 43.1 .kl file is pure defuns: no module has load-time side effects, so
-- the order below (upstream make.shen's module order, then the booted
-- extensions, then the precompiled standard library) is for readability only.
Expand Down Expand Up @@ -188,7 +188,7 @@ P.GLOBALS["*implementation*"] = rawget(_G, "jit") and "LuaJIT" or _VERSION
P.GLOBALS["*port*"] = "shen-lua"
P.GLOBALS["*porters*"] = "shen-lua contributors"
P.GLOBALS["*os*"] = (package.config and package.config:sub(1,1) == "\\") and "Windows" or "Unix"
P.GLOBALS["*release*"] = "0.1" -- port release; kernel *version* comes from init.kl ("43.1")
P.GLOBALS["*release*"] = "0.1" -- port release; kernel *version* comes from init.kl ("43.2")

-- ---- kernel bytecode cache -------------------------------------------------
-- Loading the kernel from .kl sources costs ~0.8s (read + parse + KL->Lua
Expand Down
20 changes: 20 additions & 0 deletions doc/RELEASE-0.12.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# shen-lua 0.12.0

This release moves shen-lua to the community **ShenOSKernel 43.2** (`Shen-Language/shen-sources`, tag `shen-43.2`, commit `e6947f5`), the kernel that Yggdrasil v0.1.0 requires of a stage-1 host. `(version)` prints `43.2`, and the official kernel suite passes 154/154.

It is the first release on the community kernel line; 0.11.1 shipped Tarver's S42 kernel. The vendored `klambda/` and `tests/` are byte-identical to the 43.2 release archive (SHA-256 `23c71508f0de24785e1f127ea4fab440081904d81c463090bc642ee840417f32`). The 43.2 type checker dereferences the checked term once per call and fails at once on an empty hypothesis or datatype list; the native typechecker follows it without falling back.

Also in this release, since 0.11.1:

- Strings count Unicode code points (UTF-8) (#80).
- Deep non-tail recursion, deep Prolog proofs and very long list or string literals no longer overflow LuaJIT's stack (#85, #88, #93).
- Relative file names resolve against `*home-directory*` (#86); the kernel bytecode cache lives under `$XDG_CACHE_HOME/shen-lua` instead of the current directory (#87); a nested `load` no longer runs twice on a warm cache hit (#92).
- Typechecking: `=` guards over engine terms compare in the arena, which cut a typecheck-heavy workload from about 48 s to 11 s CPU, and the native typechecker falls back loudly if the kernel's type-checker definitions differ from the ones it implements.

Full list in the [CHANGELOG](https://github.com/pyrex41/shen-lua/blob/v0.12.0/CHANGELOG.md).

## Install

From a checkout, or with Nix: `nix run github:pyrex41/shen-lua/v0.12.0 -- -e '(version)'`. The attached `shen-0.12.0-1.rockspec` and standalone `shen-bundle.lua` are alternatives. This release is not published on LuaRocks.org.

Validation: 1,798 port assertions across 29 specs and the official 43.2 kernel suite, 154/154, plus a standalone-bundle smoke test.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
packages = eachSystem (_system: pkgs: rec {
shen-lua = pkgs.stdenvNoCC.mkDerivation {
pname = "shen-lua";
version = "0.11.1";
version = "0.12.0";
src = self;

nativeBuildInputs = [ pkgs.makeWrapper ];
Expand Down
16 changes: 15 additions & 1 deletion klambda/PROVENANCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Provenance of the vendored KLambda kernel

## Current: ShenOSKernel 43.1 at upstream `ec16a9f` (community `shen-sources` line)
## Current: ShenOSKernel 43.2

- **Repository**: `Shen-Language/shen-sources`, tag `shen-43.2`
(tag object `7b7563e5`), commit `e6947f507ebc`
- **Release asset**: `ShenOSKernel-43.2.tar.gz`
- SHA-256: `23c71508f0de24785e1f127ea4fab440081904d81c463090bc642ee840417f32`
- All 23 `.kl` files and `tests/` are byte-identical to the extracted archive.
- `(version)` reports `"43.2"` (set in `init.kl`).
- Relative to the previous vendoring (43.1 at `ec16a9f`, below) only `init.kl`
(version) and `extension-type-annotations.kl` (renumbered generated names)
differ; `t-star.kl` is identical. `tests/` adds `benchmark-coverage.shen`.

The records of the earlier imports follow.

## Previous: ShenOSKernel 43.1 at upstream `ec16a9f` (community `shen-sources` line)

The 23 `.kl` files are vendored **byte-identical** from the kernel built at upstream
`Shen-Language/shen-sources` master `ec16a9f`: the 43.1 release plus the type checker's
Expand Down
10 changes: 5 additions & 5 deletions klambda/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Vendored KLambda for ShenOSKernel 43.1
# Vendored KLambda for ShenOSKernel 43.2

These are the KLambda sources of **ShenOSKernel 43.1** (community
These are the KLambda sources of **ShenOSKernel 43.2** (community
[`shen-sources`](https://github.com/Shen-Language/shen-sources) release
`shen-43.1`, as built at upstream master `ec16a9f`, which adds shen-sources#117),
`shen-43.2`, commit `e6947f507ebc`),
vendored byte-identical so that `shen-lua` is self-contained:
you can `git clone` and run without a separate kernel checkout. See
[PROVENANCE.md](PROVENANCE.md) for the exact source, checksum and the lineage
Expand All @@ -11,12 +11,12 @@ interfaces are implemented by the native Lua stream layer.

## Files

There are 23 official ShenOSKernel 43.1 `.kl` files.
There are 23 official ShenOSKernel 43.2 `.kl` files.

**Kernel (16):** core, declarations, dict, init, load, macros, prolog, reader,
sequent, sys, t-star, toplevel, track, types, writer, yacc

**Standard library (1):** stlib — precompiled from 43.1's `lib/stlib`, registered
**Standard library (1):** stlib — precompiled from 43.2's `lib/stlib`, registered
at boot by `(stlib.initialise)`.

**Extensions (6):**
Expand Down
10 changes: 5 additions & 5 deletions klambda/extension-type-annotations.kl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ BSD 3-Clause License: http://opensource.org/licenses/BSD-3-Clause"

(defun shen.x.type-annotations.function-type (V7612) (cond ((cons? V7612) false) ((not (symbol? V7612)) false) (true (let W7613 (((((lambda Z7614 (lambda Z7615 (lambda Z7616 (lambda Z7617 (let W7618 (shen.newpv Z7614) (shen.gc Z7614 (do (shen.incinfs) (shen.lookupsig (receive (shen.deref V7612 Z7614)) W7618 Z7614 Z7615 Z7616 (freeze (return W7618 Z7614 Z7615 Z7616 Z7617)))))))))) (shen.prolog-vector)) (@v true (@v 0 (vector 0)))) 0) (freeze true)) (if (= W7613 false) false (fst (shen.x.type-annotations.reify-type W7613 ())))))))

(defun shen.x.type-annotations.reify-type (V7619 V7620) (cond ((cons? V7619) (let W7621 (shen.x.type-annotations.reify-type (hd V7619) V7620) (let W7622 (shen.x.type-annotations.reify-type (tl V7619) (snd W7621)) (@p (cons (fst W7621) (fst W7622)) (snd W7622))))) ((shen.pvar? V7619) (let W7623 (<-address V7619 1) (let W7624 (assoc W7623 V7620) (if (empty? W7624) (let W7625 (gensym A) (@p W7625 (cons (cons W7623 W7625) V7620))) (@p (tl W7624) V7620))))) (true (@p V7619 V7620))))
(defun shen.x.type-annotations.reify-type (V7619 V7620) (cond ((cons? V7619) (let W7621 (shen.x.type-annotations.reify-type (hd V7619) V7620) (let W7622 (shen.x.type-annotations.reify-type (tl V7619) (snd W7621)) (@p (cons (fst W7621) (fst W7622)) (snd W7622))))) ((shen.pvar? V7619) (let W7623 (assoc V7619 V7620) (if (empty? W7623) (let W7624 (gensym A) (@p W7624 (cons (cons V7619 W7624) V7620))) (@p (tl W7623) V7620)))) (true (@p V7619 V7620))))

(defun shen.x.type-annotations.type-table (V7630 V7631) (cond ((and (cons? V7630) (and (cons? (tl V7630)) (and (= --> (hd (tl V7630))) (and (cons? (tl (tl V7630))) (and (= () (tl (tl (tl V7630)))) (cons? V7631)))))) (if (variable? (hd V7630)) (shen.x.type-annotations.type-table (hd (tl (tl V7630))) (tl V7631)) (cons (cons (hd V7631) (hd V7630)) (shen.x.type-annotations.type-table (hd (tl (tl V7630))) (tl V7631))))) (true ())))
(defun shen.x.type-annotations.type-table (V7629 V7630) (cond ((and (cons? V7629) (and (cons? (tl V7629)) (and (= --> (hd (tl V7629))) (and (cons? (tl (tl V7629))) (and (= () (tl (tl (tl V7629)))) (cons? V7630)))))) (if (variable? (hd V7629)) (shen.x.type-annotations.type-table (hd (tl (tl V7629))) (tl V7630)) (cons (cons (hd V7630) (hd V7629)) (shen.x.type-annotations.type-table (hd (tl (tl V7629))) (tl V7630))))) (true ())))

(defun shen.x.type-annotations.annotate (V7632 V7633 V7634) (cond ((and (cons? V7634) (and (= type (hd V7634)) (and (cons? (tl V7634)) (and (cons? (tl (tl V7634))) (= () (tl (tl (tl V7634)))))))) V7634) ((and (cons? V7634) (and (= let (hd V7634)) (and (cons? (tl V7634)) (and (cons? (tl (tl V7634))) (and (cons? (tl (tl (tl V7634)))) (= () (tl (tl (tl (tl V7634)))))))))) (cons let (cons (hd (tl V7634)) (cons (shen.x.type-annotations.annotate V7632 V7633 (hd (tl (tl V7634)))) (cons (shen.x.type-annotations.annotate (cons (hd (tl V7634)) V7632) V7633 (hd (tl (tl (tl V7634))))) ()))))) ((and (cons? V7634) (and (= lambda (hd V7634)) (and (cons? (tl V7634)) (and (cons? (tl (tl V7634))) (= () (tl (tl (tl V7634)))))))) (cons lambda (cons (hd (tl V7634)) (cons (shen.x.type-annotations.annotate (cons (hd (tl V7634)) V7632) V7633 (hd (tl (tl V7634)))) ())))) ((and (cons? V7634) (= cond (hd V7634))) (cons cond (shen.x.type-annotations.annotate-cases V7632 V7633 (tl V7634)))) ((cons? V7634) (let W7635 (shen.x.type-annotations.function-type (hd V7634)) (let W7636 (shen.x.type-annotations.type-table W7635 (tl V7634)) (cons (hd V7634) (map (lambda Z7637 (shen.x.type-annotations.annotate V7632 (append V7633 W7636) Z7637)) (tl V7634)))))) (true (let W7638 (assoc V7634 V7633) (if (cons? W7638) (cons type (cons V7634 (cons (tl W7638) ()))) (if (element? V7634 V7632) V7634 (shen.x.type-annotations.atom-type V7634)))))))
(defun shen.x.type-annotations.annotate (V7631 V7632 V7633) (cond ((and (cons? V7633) (and (= type (hd V7633)) (and (cons? (tl V7633)) (and (cons? (tl (tl V7633))) (= () (tl (tl (tl V7633)))))))) V7633) ((and (cons? V7633) (and (= let (hd V7633)) (and (cons? (tl V7633)) (and (cons? (tl (tl V7633))) (and (cons? (tl (tl (tl V7633)))) (= () (tl (tl (tl (tl V7633)))))))))) (cons let (cons (hd (tl V7633)) (cons (shen.x.type-annotations.annotate V7631 V7632 (hd (tl (tl V7633)))) (cons (shen.x.type-annotations.annotate (cons (hd (tl V7633)) V7631) V7632 (hd (tl (tl (tl V7633))))) ()))))) ((and (cons? V7633) (and (= lambda (hd V7633)) (and (cons? (tl V7633)) (and (cons? (tl (tl V7633))) (= () (tl (tl (tl V7633)))))))) (cons lambda (cons (hd (tl V7633)) (cons (shen.x.type-annotations.annotate (cons (hd (tl V7633)) V7631) V7632 (hd (tl (tl V7633)))) ())))) ((and (cons? V7633) (= cond (hd V7633))) (cons cond (shen.x.type-annotations.annotate-cases V7631 V7632 (tl V7633)))) ((cons? V7633) (let W7634 (shen.x.type-annotations.function-type (hd V7633)) (let W7635 (shen.x.type-annotations.type-table W7634 (tl V7633)) (cons (hd V7633) (map (lambda Z7636 (shen.x.type-annotations.annotate V7631 (append V7632 W7635) Z7636)) (tl V7633)))))) (true (let W7637 (assoc V7633 V7632) (if (cons? W7637) (cons type (cons V7633 (cons (tl W7637) ()))) (if (element? V7633 V7631) V7633 (shen.x.type-annotations.atom-type V7633)))))))

(defun shen.x.type-annotations.annotate-cases (V7647 V7648 V7649) (cond ((= () V7649) ()) ((and (cons? V7649) (and (cons? (hd V7649)) (and (cons? (tl (hd V7649))) (= () (tl (tl (hd V7649))))))) (cons (cons (shen.x.type-annotations.annotate V7647 V7648 (hd (hd V7649))) (cons (shen.x.type-annotations.annotate V7647 V7648 (hd (tl (hd V7649)))) ())) (shen.x.type-annotations.annotate-cases V7647 V7648 (tl V7649)))) (true V7649)))
(defun shen.x.type-annotations.annotate-cases (V7646 V7647 V7648) (cond ((= () V7648) ()) ((and (cons? V7648) (and (cons? (hd V7648)) (and (cons? (tl (hd V7648))) (= () (tl (tl (hd V7648))))))) (cons (cons (shen.x.type-annotations.annotate V7646 V7647 (hd (hd V7648))) (cons (shen.x.type-annotations.annotate V7646 V7647 (hd (tl (hd V7648)))) ())) (shen.x.type-annotations.annotate-cases V7646 V7647 (tl V7648)))) (true V7648)))

(defun shen.x.type-annotations.atom-type (V7650) (if (string? V7650) (cons type (cons V7650 (cons string ()))) (if (number? V7650) (cons type (cons V7650 (cons number ()))) (if (boolean? V7650) (cons type (cons V7650 (cons boolean ()))) (if (symbol? V7650) (cons type (cons V7650 (cons symbol ()))) V7650)))))
(defun shen.x.type-annotations.atom-type (V7649) (if (string? V7649) (cons type (cons V7649 (cons string ()))) (if (number? V7649) (cons type (cons V7649 (cons number ()))) (if (boolean? V7649) (cons type (cons V7649 (cons boolean ()))) (if (symbol? V7649) (cons type (cons V7649 (cons symbol ()))) V7649)))))

Loading
Loading