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.
This commit is contained in:
Dmitri Sotnikov 2026-06-09 07:30:25 +08:00 committed by GitHub
parent 607779866e
commit d3194aae59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
68 changed files with 6590 additions and 2019 deletions

43
.calva/repl.calva-repl Normal file
View file

@ -0,0 +1,43 @@
(when-let [requires (resolve 'clojure.main/repl-requires)] (clojure.core/apply clojure.core/require @requires))
cljuser> 
(defn read
[reader]
(let [line ((get (dyn :current-env) (symbol "file/read")) reader :line)]
(when line
(read-string line))))
cljuser> 
(defn foo [])
cljuser> 
(foo)
cljuser> 
(defn foo [x]
(into (range 10) [x]))
cljuser> 
(foo)
; expected integer key for tuple in range [0, 0), got 0
cljuser> 
(foo 10)
cljuser> 
(foo "a")
cljuser> 
(foo :a)
cljuser> 
(sh "ls")
; Unable to resolve symbol: sh
cljuser> 
(jolt/sh "ls")
; Unable to resolve symbol: jolt/sh
cljuser> 
(defn sh
[& args]
(let [cmd (apply str (interpose " " args))
result (os/shell cmd)]
{:exit (result 0) :out (result 1) :err (result 2)}))
cljuser> 
(defn shell
[& args]
(:out (apply sh args)))
cljuser> 
(sh "ls")
; Unable to resolve symbol: os/shell
cljuser>