chore: rebrand Clojure/Nim → Bara Lang across codebase
- 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
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Clojure/Nim Experiments
|
||||
# Bara Lang Experiments
|
||||
|
||||
Unconventional compilation targets that JVM Clojure cannot do.
|
||||
|
||||
@@ -10,7 +10,7 @@ Unconventional compilation targets that JVM Clojure cannot do.
|
||||
| `native-lib/` | ✅ Working | Clojure → Nim → C shared library (.so) |
|
||||
| `wasm-target/` | 🏗️ Skeleton | Clojure → Nim → WASM via Emscripten |
|
||||
|
||||
## web-target — Clojure in the Browser
|
||||
## web-target — Bara Lang in the Browser
|
||||
|
||||
```bash
|
||||
cd web-target
|
||||
@@ -19,9 +19,9 @@ node -e "require('./build/math.js'); console.log(jsSquare(7))"
|
||||
# → 49
|
||||
```
|
||||
|
||||
**Unique:** No JVM, no JavaScript source code — pure Clojure compiled to JS.
|
||||
**Unique:** No JVM, no JavaScript source code — pure Bara Lang compiled to JS.
|
||||
|
||||
## native-lib — Clojure as a C Library
|
||||
## native-lib — Bara Lang as a C Library
|
||||
|
||||
```bash
|
||||
cd native-lib
|
||||
@@ -31,9 +31,9 @@ cd test_client && make && LD_LIBRARY_PATH=../build ./test_client
|
||||
# → c_factorial(5) = 120
|
||||
```
|
||||
|
||||
**Unique:** Call Clojure functions from Python, Rust, Go, C via FFI.
|
||||
**Unique:** Call Bara Lang functions from Python, Rust, Go, C via FFI.
|
||||
|
||||
## wasm-target — Clojure at Native Speed in Browser
|
||||
## wasm-target — Bara Lang at Native Speed in Browser
|
||||
|
||||
```bash
|
||||
cd wasm-target
|
||||
@@ -42,14 +42,14 @@ cd wasm-target
|
||||
# Open www/index.html in browser
|
||||
```
|
||||
|
||||
**Unique:** Clojure running as WebAssembly — faster than ClojureScript, smaller than JVM.
|
||||
**Unique:** Bara Lang running as WebAssembly — faster than ClojureScript, smaller than JVM.
|
||||
|
||||
## Architecture
|
||||
|
||||
All experiments share the same pipeline:
|
||||
|
||||
```
|
||||
Clojure Source (.clj)
|
||||
Bara Lang Source (.clj)
|
||||
↓
|
||||
cljnim compile-lib
|
||||
↓
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Clojure/Nim → Native Shared Library
|
||||
# Bara Lang → Native Shared Library
|
||||
|
||||
Compile Clojure code to a C shared library (`.so` / `.dll` / `.dylib`).
|
||||
Compile Bara Lang code to a C shared library (`.so` / `.dll` / `.dylib`).
|
||||
|
||||
## Why?
|
||||
|
||||
- **Embed Clojure in Python/Rust/Go/C** via FFI
|
||||
- **Embed Bara Lang in Python/Rust/Go/C** via FFI
|
||||
- **Tiny binaries** — no JVM overhead
|
||||
- **True C ABI** — call Clojure functions from any language
|
||||
- **True C ABI** — call Bara Lang functions from any language
|
||||
|
||||
## Quick Start
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Generated by Clojure/Nim
|
||||
# Generated by Bara Lang
|
||||
import cljnim_runtime
|
||||
|
||||
proc square*(x: CljVal): CljVal =
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# C-friendly wrappers around Clojure-generated code
|
||||
# C-friendly wrappers around Bara Lang-generated code
|
||||
# Exports plain C types (int, char*) instead of CljVal
|
||||
|
||||
import cljnim_runtime
|
||||
|
||||
# Import the generated Clojure functions
|
||||
# Import the generated Bara Lang functions
|
||||
include build/math
|
||||
|
||||
proc c_square*(x: cint): cint {.exportc, dynlib.} =
|
||||
|
||||
@@ -12,13 +12,13 @@ extern void NimMain(void);
|
||||
int main(void) {
|
||||
NimMain();
|
||||
|
||||
printf("=== Clojure/Nim Native Library Test ===\n\n");
|
||||
printf("=== Bara Lang Native Library Test ===\n\n");
|
||||
|
||||
printf("c_square(7) = %d\n", c_square(7));
|
||||
printf("c_add(10, 20) = %d\n", c_add(10, 20));
|
||||
printf("c_factorial(5) = %d\n", c_factorial(5));
|
||||
printf("c_greet(\"World\") = %s\n", c_greet("World"));
|
||||
|
||||
printf("\nAll tests passed! Clojure in a .so file.\n");
|
||||
printf("\nAll tests passed! Bara Lang in a .so file.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Clojure/Nim → WASM (via Emscripten)
|
||||
# Bara Lang → WASM (via Emscripten)
|
||||
|
||||
Compile Clojure code to WebAssembly using Nim's Emscripten backend.
|
||||
Compile Bara Lang code to WebAssembly using Nim's Emscripten backend.
|
||||
|
||||
## Why?
|
||||
|
||||
@@ -31,7 +31,7 @@ Then open `www/index.html` in a browser.
|
||||
1. `cljnim compile-lib` — generates Nim with exported functions
|
||||
2. `nim c -d:emscripten` — compiles Nim to WASM + JS glue
|
||||
3. Browser loads `math.js` (glue) + `math.wasm` (WASM module)
|
||||
4. JS calls `_wasmSquare(7)` → WASM executes native Clojure code
|
||||
4. JS calls `_wasmSquare(7)` → WASM executes native Bara Lang code
|
||||
|
||||
## Future
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# WASM-friendly wrappers around Clojure-generated code
|
||||
# WASM-friendly wrappers around Bara Lang-generated code
|
||||
# Uses Emscripten FFI: cint → JS number, cstring → JS string
|
||||
|
||||
import cljnim_runtime
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Clojure/Nim → WASM Demo</title>
|
||||
<title>Bara Lang → WASM Demo</title>
|
||||
<style>
|
||||
body { font-family: monospace; max-width: 800px; margin: 40px auto; padding: 20px; background: #1a1a2e; color: #eee; }
|
||||
h1 { color: #e94560; }
|
||||
@@ -10,8 +10,8 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>⚡ Clojure/Nim → WASM (Emscripten)</h1>
|
||||
<p>Clojure compiled to Nim, then to WebAssembly via Emscripten.</p>
|
||||
<h1>⚡ Bara Lang → WASM (Emscripten)</h1>
|
||||
<p>Bara Lang compiled to Nim, then to WebAssembly via Emscripten.</p>
|
||||
|
||||
<div class="result">
|
||||
<div id="output">Loading WASM module...</div>
|
||||
@@ -25,7 +25,7 @@
|
||||
<b>wasmSquare(7)</b> = ${Module._wasmSquare(7)}<br>
|
||||
<b>wasmFactorial(5)</b> = ${Module._wasmFactorial(5)}<br>
|
||||
<br>
|
||||
<i>Clojure running at native speed in your browser!</i>
|
||||
<i>Bara Lang running at native speed in your browser!</i>
|
||||
`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Clojure/Nim → JavaScript
|
||||
# Bara Lang → JavaScript
|
||||
|
||||
Compile Clojure code to JavaScript via Nim's JS backend.
|
||||
Compile Bara Lang code to JavaScript via Nim's JS backend.
|
||||
|
||||
## Why?
|
||||
|
||||
- **No JVM** — Clojure in the browser without 50MB runtime
|
||||
- **No JavaScript** — write Clojure, get JS
|
||||
- **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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Generated by Clojure/Nim
|
||||
# Generated by Bara Lang
|
||||
import cljnim_runtime_js
|
||||
|
||||
proc square*(x: CljVal): CljVal =
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# JS-friendly wrappers around Clojure-generated code
|
||||
# JS-friendly wrappers around Bara Lang-generated code
|
||||
# These expose plain JS types (number, string) instead of CljVal
|
||||
|
||||
import cljnim_runtime_js
|
||||
|
||||
# Import the generated Clojure functions
|
||||
# Import the generated Bara Lang functions
|
||||
include build/math
|
||||
|
||||
proc jsSquare*(x: int): int {.exportc.} =
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Clojure/Nim → JS Demo</title>
|
||||
<title>Bara Lang → JS Demo</title>
|
||||
<style>
|
||||
body { font-family: monospace; max-width: 800px; margin: 40px auto; padding: 20px; background: #1a1a2e; color: #eee; }
|
||||
h1 { color: #e94560; }
|
||||
@@ -14,8 +14,8 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>🔥 Clojure/Nim → JavaScript</h1>
|
||||
<p>Clojure code compiled to Nim, then to JavaScript. Running in your browser.</p>
|
||||
<h1>🔥 Bara Lang → JavaScript</h1>
|
||||
<p>Bara Lang code compiled to Nim, then to JavaScript. Running in your browser.</p>
|
||||
|
||||
<div class="result">
|
||||
<div class="label">square(7)</div>
|
||||
|
||||
Reference in New Issue
Block a user