5 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
63d92cd122
|
Stage2 task2 tier4b (#15)
* core: Stage 2 Task 2 tier 4b — compile ns (+ use/import/refer-clojure) ns becomes a macro (00-syntax) expanding to (do (in-ns 'name) (require …) (use …) (import …) (refer-clojure …)) — matching Clojure, where require is a fn and ns expands to require calls. use/import/refer-clojure join the namespace ops as ctx-capturing clojure.core fns (use-impl/import-impl/ refer-clojure-impl, interned by install-stateful-fns!). Removed the ns interpreter special arm; dropped ns/use/import from host_iface special-names and loader stateful-head?. Placement matters: ns lives in the FIRST overlay tier (00-syntax), because the self-hosted analyzer build is triggered while 10-seq loads and processes jolt.analyzer's own (ns …) form — ns must exist by then. Its body resolves fn/map/reduce/cond at expansion time, by which point all of 00-syntax has loaded. The bootstrap compiler (compiler.janet) still PUNTS ns/in-ns/require/ use/import (it compiles analyzer.clj/ir.clj, whose ns forms must fall back to the interpreter that expands the macro) — only the self-hosted analyzer compiles them. use-impl fixes a latent bug: it now refers the used ns's vars into the CURRENT ns (the old special interned a ns into itself, a no-op). ns/use/import now compile + interpret as plain invokes. fallback-zero: ns off must-punt, onto must-compile. Gate green: conformance 267x3, fallback-zero 38/4, bootstrap-fixpoint stage1==2==3, self-host, staged-bootstrap, sci-bootstrap, clojure-test-suite >=4034/67, namespace, deps-loader, cli, aot, embedded-stdlib, uberscript, features 78/78, all unit + spec. * test/core: cover ns form + :use; fix use-impl spec parsing Checking test coverage for the namespace tiers surfaced a real bug nothing exercised: use-impl checked (array? s) to find a spec's ns symbol, but a vector spec like [src.x] is a pvec/tuple, not a Janet array — so (:use ...) and standalone (use ...) errored. Fixed to coerce (pvec->array) then take the head when the spec is indexed (matching require-impl). Added coverage that was missing: - conformance (x3 modes): the (ns …) form itself + :use refers. - namespaces-spec: (ns …) form, :use, standalone use. The :use/(use …) path had ZERO tests before, which is why the bug slipped through earlier tiers. EBNF needs no change — it's a reader/syntax grammar with no special-forms enumeration; ns/require/protocol syntax is unchanged (the destructuring note was already updated in jolt-f79). Gate green: conformance 269x3, fallback-zero 38/4, self-host, sci-bootstrap, bootstrap-fixpoint, staged-bootstrap, clojure-test-suite >=4034/67, namespace, all unit + spec (namespaces 27/27). --------- Co-authored-by: Yogthos <yogthos@gmail.com> |
||
|
|
1ded89b47b
|
Stage1 analyzer parity (#11)
* compiler: self-hosted analyzer compiles set literals (#{…})
Stage 1 Task 1. analyzer.clj punted set literals to the interpreter
((form-set? form) (uncompilable "set literal")); now it builds the set-node IR
(already defined in ir.clj) from (form-set-items form), and backend.janet emits
(make-phs e1 e2 …) — each element evaluated then the persistent set built,
mirroring compiler.janet's emit-set-expr and the interpreter's :jolt/set path.
Closes a self-hosted-analyzer vs bootstrap-compiler parity gap: #{…} no longer
forces interpreter fallback on the compile path.
Gate: conformance 262x3 (+4 set-literal cases incl computed elements / empty /
in-let), fixpoint, self-host, sci, suite 3981/66, specs+unit green; core-bench
neutral (A/B). set?/disj-as-fns remain deliberately interpreted (in-sync across
all three lists) — adjudicated in Task 2.
* test: fallback-zero harness — assert non-stateful forms compile (not interpret)
Stage 1 Task 3. self-host-test checks results but not which path ran. This runs
the portable analyzer (backend/analyze-form) on a corpus of non-stateful forms
and asserts NONE raise :jolt/uncompilable — i.e. the self-hosted analyzer
compiled them, not the interpreter fallback. Inverse sanity list confirms a few
intentional-interpret forms (ns/defmacro/require/set?/letfn) still punt, so the
harness can't pass by compiling everything.
29 must-compile (incl set literals from Task 1) + 5 must-punt, 0 failures. As
Stage 1 parity grows, forms move from the punt list into must-compile; when the
fallback set equals the frozen intentional stateful set, the bootstrap is
retireable.
* core: migrate 7 lazy seq fns from the Janet seed to the Clojure overlay (40-lazy)
Finishes a port the prior team started and reverted (
|
||
|
|
d3194aae59
|
Compiler research (#10)
adds self-hosted compiler is functionally: - The default compile path is the portable pipeline using jolt.analyzer (Clojure) → host-neutral IR → backend.janet. - The analyzer is itself Clojure, compiled by jolt for true self-hosting. - bootstrap-fixpoint passes (stage1 == stage2 == stage3): rebuilding the compiler on its own output. - clojure.core is now self-hosted in the overlay. - Stateful forms (defmacro/ns/deftype/defmulti/require/in-ns) are interpreted by design. |
||
|
|
360b23c8af |
feat: distinguish map entries from vectors; min-key NaN ordering; subvec float coercion
- A map entry is a 2-element tuple (Jolt produces tuples only from map iteration; vector literals are pvecs, lists are arrays). key/val/map-entry? now accept a 2-tuple and reject a plain vector, matching Clojure's MapEntry-vs-vector distinction — no metadata needed, the representations already differ. - min-key/max-key reproduce Clojure's NaN-aware folding (2-arg strict </>, then <=/>=) and require numeric keys (NaN allowed, strings throw). - subvec coerces float/NaN indices like (int ...) (truncate, NaN->0) then bounds-checks, instead of throwing on non-integers. min_key 35/14 -> 49/0 (clean); key/val recover the 2-vector cases; subvec floats fixed. clojure-test-suite pass 3898->3921. Updated conformance-test (key/val now needs a real entry). spec: map/map-entry-&-key-ordering (14). jpm test green. |
||
|
|
16428179fa |
test: restructure into unit / integration / spec layers + shared harness
Reorganize the flat 49-file test/ into three layers (jpm test recurses, so all
are still discovered):
- test/unit/ white-box component tests (reader, evaluator, types,
persistent-map, lazy-seq, macro, interop, compiler)
- test/integration/ cross-cutting + regression batteries (conformance, jank,
sci-bootstrap/runtime, features, systematic-coverage, api,
core, namespaces, ported clojure suites) and
.../ports/ ported clojure/cljs test batches pending consolidation
- test/spec/ the behavioral contract (built out in following commits)
- test/support/harness.janet shared defspec table runner (cases compared via
Jolt's own =, with a :throws sentinel) + expect= helpers
Files moved with git mv (history preserved) and import paths fixed for depth.
jpm test green. README Test section updated.
Next: build out test/spec/ to cover the public API area-by-area, mining the
integration batteries and filling gaps.
|
Renamed from test/conformance.janet (Browse further)