ba0b300917
- New TUI screens: Main Menu, Compile, Run, REPL, AI Generator, AI Settings, Help - AI configuration persisted in ~/.config/cljnim/config.json - Added illwill dependency for terminal UI - Updated experiments, examples, docs, and core modules
1.6 KiB
1.6 KiB
Clojure/Nim Experiments
Unconventional compilation targets that JVM Clojure cannot do.
Projects
| Experiment | Status | Description |
|---|---|---|
web-target/ |
✅ Working | Clojure → Nim → JavaScript for browsers |
native-lib/ |
✅ Working | Clojure → Nim → C shared library (.so) |
wasm-target/ |
🏗️ Skeleton | Clojure → Nim → WASM via Emscripten |
web-target — Clojure in the Browser
cd web-target
./build.sh
node -e "require('./build/math.js'); console.log(jsSquare(7))"
# → 49
Unique: No JVM, no JavaScript source code — pure Clojure compiled to JS.
native-lib — Clojure as a C Library
cd native-lib
./build.sh
cd test_client && make && LD_LIBRARY_PATH=../build ./test_client
# → c_square(7) = 49
# → c_factorial(5) = 120
Unique: Call Clojure functions from Python, Rust, Go, C via FFI.
wasm-target — Clojure at Native Speed in Browser
cd wasm-target
# Install Emscripten first, then:
./build.sh
# Open www/index.html in browser
Unique: Clojure running as WebAssembly — faster than ClojureScript, smaller than JVM.
Architecture
All experiments share the same pipeline:
Clojure Source (.clj)
↓
cljnim compile-lib
↓
Nim Source (.nim) with exported procs
↓
Target-specific wrapper
↓
nim c --target=...
↓
JS / .so / .wasm
Adding a New Experiment
- Create a folder:
experiments/my-target/ - Write Clojure example in
examples/ - Write Nim wrapper in
my_wrappers.nim - Write
build.shusingcljnim compile-lib - Add row to the table above