79cd9c08d8
- Bulk replace Clojure/Nim → Bara Lang in src/, lib/, examples/, benchmarks/, experiments/, books/, LICENSE, cljnim.nimble, PLAN.md, AI_AGENT.md - Rename book chapters: 05-clojure-nim.md → 05-bara-lang.md (en + bg) - Update all chapter index links and anchors - Replace project-specific 'Clojure' references with 'Bara Lang' in experiments/, src/ai_assist.nim, src/tui_screens.nim, src/emitter.nim, src/reader.nim, src/types.nim, lib/cljnim_runtime*.nim - Keep legitimate JVM Clojure/ClojureScript/Clojure CLR references intact
37 lines
955 B
Markdown
37 lines
955 B
Markdown
# Bara Lang → JavaScript
|
|
|
|
Compile Bara Lang code to JavaScript via Nim's JS backend.
|
|
|
|
## Why?
|
|
|
|
- **No JVM** — Bara Lang in the browser without 50MB runtime
|
|
- **No JavaScript** — write Bara Lang, get JS
|
|
- **Smaller than ClojureScript** — no Google Closure compiler needed
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
./build.sh
|
|
```
|
|
|
|
Then open `www/index.html` in a browser.
|
|
|
|
## How it works
|
|
|
|
1. `cljnim compile-lib` — generates Nim with exported functions
|
|
2. `js_wrappers.nim` — thin wrappers that convert CljVal ↔ JS types
|
|
3. `nim js` — compiles Nim to JavaScript
|
|
4. Browser loads `math.js` and calls `jsSquare(7)`, `jsFactorial(5)`, etc.
|
|
|
|
## Limitations
|
|
|
|
- Full `cljnim_runtime.nim` uses C FFI (threads, processes) — not JS-compatible
|
|
- For now, only numeric and string functions work
|
|
- Persistent data structures need JS-specific runtime
|
|
|
|
## Future
|
|
|
|
- Full JS runtime for HAMT vectors/maps
|
|
- DOM interop: `(dom/getElementById "app")`
|
|
- npm package output
|