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:
parent
607779866e
commit
d3194aae59
68 changed files with 6590 additions and 2019 deletions
43
.calva/repl.calva-repl
Normal file
43
.calva/repl.calva-repl
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
(when-let [requires (resolve 'clojure.main/repl-requires)] (clojure.core/apply clojure.core/require @requires))
|
||||
clj꞉user꞉>
|
||||
(defn read
|
||||
[reader]
|
||||
(let [line ((get (dyn :current-env) (symbol "file/read")) reader :line)]
|
||||
(when line
|
||||
(read-string line))))
|
||||
clj꞉user꞉>
|
||||
(defn foo [])
|
||||
clj꞉user꞉>
|
||||
(foo)
|
||||
clj꞉user꞉>
|
||||
(defn foo [x]
|
||||
(into (range 10) [x]))
|
||||
clj꞉user꞉>
|
||||
(foo)
|
||||
; expected integer key for tuple in range [0, 0), got 0
|
||||
clj꞉user꞉>
|
||||
(foo 10)
|
||||
clj꞉user꞉>
|
||||
(foo "a")
|
||||
clj꞉user꞉>
|
||||
(foo :a)
|
||||
clj꞉user꞉>
|
||||
(sh "ls")
|
||||
; Unable to resolve symbol: sh
|
||||
clj꞉user꞉>
|
||||
(jolt/sh "ls")
|
||||
; Unable to resolve symbol: jolt/sh
|
||||
clj꞉user꞉>
|
||||
(defn sh
|
||||
[& args]
|
||||
(let [cmd (apply str (interpose " " args))
|
||||
result (os/shell cmd)]
|
||||
{:exit (result 0) :out (result 1) :err (result 2)}))
|
||||
clj꞉user꞉>
|
||||
(defn shell
|
||||
[& args]
|
||||
(:out (apply sh args)))
|
||||
clj꞉user꞉>
|
||||
(sh "ls")
|
||||
; Unable to resolve symbol: os/shell
|
||||
clj꞉user꞉>
|
||||
Loading…
Add table
Add a link
Reference in a new issue