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:
+10
-10
@@ -1,4 +1,4 @@
|
||||
# AI Assistance for Clojure/Nim Compiler
|
||||
# AI Assistance for Bara Lang Compiler
|
||||
# Supports DeepSeek API and OpenAI-compatible APIs (Xiaomi MiMo, etc.)
|
||||
# API keys are read from environment variables — never hardcoded.
|
||||
|
||||
@@ -95,7 +95,7 @@ proc getCachedError*(errorMsg, fileName: string): string =
|
||||
|
||||
proc buildErrorPrompt*(errorMsg, sourceCode, fileName: string): string =
|
||||
## Build a prompt for the AI to analyze a compiler error
|
||||
result = """You are an expert Clojure/Nim compiler assistant. The user got a compilation error.
|
||||
result = """You are an expert Bara Lang compiler assistant. The user got a compilation error.
|
||||
|
||||
**File:** """ & fileName & """
|
||||
|
||||
@@ -110,21 +110,21 @@ proc buildErrorPrompt*(errorMsg, sourceCode, fileName: string): string =
|
||||
```
|
||||
|
||||
Please explain the error in simple terms and suggest a fix. Keep your response under 200 words.
|
||||
If the error is in Clojure code, show the corrected Clojure snippet.
|
||||
If the error is in Bara Lang code, show the corrected Bara Lang snippet.
|
||||
Respond in the same language as the user's source code comments (Bulgarian or English).
|
||||
"""
|
||||
|
||||
proc buildGenerationPrompt*(description: string): string =
|
||||
## Build a prompt for AI code generation
|
||||
result = """You are an expert Clojure programmer. Generate a Clojure function based on this description:
|
||||
result = """You are an expert Bara Lang programmer. Generate a Bara Lang function based on this description:
|
||||
|
||||
""" & description & """
|
||||
|
||||
Requirements:
|
||||
- Use idiomatic Clojure
|
||||
- Use idiomatic Bara Lang
|
||||
- Include docstring
|
||||
- Use loop/recur instead of recursion if possible
|
||||
- Return ONLY the Clojure code, no explanations
|
||||
- Return ONLY the Bara Lang code, no explanations
|
||||
"""
|
||||
|
||||
proc buildOptimizationPrompt*(code: string): string =
|
||||
@@ -142,7 +142,7 @@ Consider:
|
||||
- Transients for batch operations
|
||||
- Parallelization opportunities (pmap, reducers)
|
||||
|
||||
Keep response under 200 words. Return ONLY Clojure code suggestions, no explanations.
|
||||
Keep response under 200 words. Return ONLY Bara Lang code suggestions, no explanations.
|
||||
"""
|
||||
|
||||
proc buildDebugPrompt*(code: string, evalResult: string): string =
|
||||
@@ -216,19 +216,19 @@ proc explainError*(errorMsg, sourceCode, fileName: string): AiResponse =
|
||||
return res
|
||||
|
||||
proc generateCode*(description: string): AiResponse =
|
||||
## High-level helper: generate Clojure code from description
|
||||
## High-level helper: generate Bara Lang code from description
|
||||
let config = detectConfig()
|
||||
let prompt = buildGenerationPrompt(description)
|
||||
return callAiApi(config, prompt)
|
||||
|
||||
proc optimizeCode*(code: string): AiResponse =
|
||||
## High-level helper: suggest optimizations for Clojure code
|
||||
## High-level helper: suggest optimizations for Bara Lang code
|
||||
let config = detectConfig()
|
||||
let prompt = buildOptimizationPrompt(code)
|
||||
return callAiApi(config, prompt)
|
||||
|
||||
proc debugCode*(code: string, evalResult: string): AiResponse =
|
||||
## High-level helper: debug a Clojure expression and its result
|
||||
## High-level helper: debug a Bara Lang expression and its result
|
||||
let config = detectConfig()
|
||||
let prompt = buildDebugPrompt(code, evalResult)
|
||||
return callAiApi(config, prompt)
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
# Clojure/Nim — AI-First Clojure Compiler
|
||||
# Bara Lang — AI-First Compiler
|
||||
import os, osproc, strutils, times
|
||||
import reader, emitter, types, repl, macros, deps, ai_assist, tui
|
||||
|
||||
@@ -213,7 +213,7 @@ proc main() =
|
||||
let args = commandLineParams()
|
||||
|
||||
if args.len == 0:
|
||||
echo "Clojure/Nim — AI-First Clojure Compiler"
|
||||
echo "Bara Lang — AI-First Compiler"
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " cljnim compile <file.clj> [output.nim] Compile to Nim source"
|
||||
@@ -222,7 +222,7 @@ proc main() =
|
||||
echo " cljnim repl [--json] Start REPL (human or AI mode)"
|
||||
echo " cljnim deps Resolve dependencies from deps.edn"
|
||||
echo " cljnim -e '<code>' Evaluate expression"
|
||||
echo " cljnim ai '<description>' Generate Clojure code with AI"
|
||||
echo " cljnim ai '<description>' Generate Bara Lang code with AI"
|
||||
echo " cljnim tui Start interactive TUI"
|
||||
echo ""
|
||||
echo "REPL Commands:"
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
# Clojure → Nim Emitter
|
||||
# Bara Lang → Nim Emitter
|
||||
import strutils, sets, algorithm
|
||||
import types
|
||||
import macros
|
||||
@@ -2059,7 +2059,7 @@ proc emitProgramInternal(forms: seq[CljVal]): string =
|
||||
pushScope()
|
||||
requiredImports = initHashSet[string]()
|
||||
var headerLines: seq[string] = @[
|
||||
"# Generated by Clojure/Nim",
|
||||
"# Generated by Bara Lang",
|
||||
"import cljnim_runtime",
|
||||
]
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Clojure Reader (EDN subset)
|
||||
# Bara Lang Reader (EDN subset)
|
||||
import strutils
|
||||
import types
|
||||
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
# AI-First REPL for Clojure/Nim
|
||||
# AI-First REPL for Bara Lang
|
||||
import os, osproc, strutils, json, times, net
|
||||
import reader, emitter, types, macros, eval, ai_assist
|
||||
|
||||
@@ -82,7 +82,7 @@ proc buildProgram(state: ReplState, form: CljVal, isDef: bool): string =
|
||||
allForms.add(form)
|
||||
|
||||
var header = @[
|
||||
"# Generated by Clojure/Nim REPL",
|
||||
"# Generated by Bara Lang REPL",
|
||||
"import cljnim_runtime",
|
||||
"",
|
||||
]
|
||||
@@ -252,7 +252,7 @@ proc evalForm*(state: var ReplState, formStr: string): JsonNode =
|
||||
}
|
||||
|
||||
proc runHumanRepl*(state: var ReplState) =
|
||||
echo "Clojure/Nim REPL"
|
||||
echo "Bara Lang REPL"
|
||||
echo "Type :quit to exit, :help for commands"
|
||||
echo ""
|
||||
|
||||
@@ -275,7 +275,7 @@ proc runHumanRepl*(state: var ReplState) =
|
||||
echo ":defs List defined vars"
|
||||
echo ":clear Clear all definitions"
|
||||
echo ":ns Show current namespace"
|
||||
echo ":ai <desc> Ask AI to generate Clojure code"
|
||||
echo ":ai <desc> Ask AI to generate Bara Lang code"
|
||||
echo ":optimize <code> Ask AI to suggest optimizations"
|
||||
echo ":debug <expr> Ask AI to debug an expression"
|
||||
of ":defs":
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
# Clojure/Nim TUI — Terminal User Interface
|
||||
# Bara Lang TUI — Terminal User Interface
|
||||
# Fullscreen menu-driven interface for cljnim
|
||||
|
||||
import std/os
|
||||
@@ -72,7 +72,7 @@ proc runTui*() =
|
||||
illwillDeinit()
|
||||
showCursor()
|
||||
echo ""
|
||||
echo "=== Starting Clojure/Nim REPL ==="
|
||||
echo "=== Starting Bara Lang REPL ==="
|
||||
echo "Type :quit to return to TUI"
|
||||
echo ""
|
||||
var replState = initReplState(rmHuman)
|
||||
|
||||
+3
-3
@@ -127,7 +127,7 @@ proc drawMainMenu*(tb: var TerminalBuffer, state: var ScreenState) =
|
||||
let h = terminalHeight()
|
||||
|
||||
# Header
|
||||
let title = "Clojure/Nim TUI"
|
||||
let title = "Bara Lang TUI"
|
||||
tb.write(centerX(title, w), 1, fgCyan, title)
|
||||
tb.drawHorizLine(0, w - 1, 2, doubleStyle = true)
|
||||
|
||||
@@ -436,7 +436,7 @@ proc drawRun*(tb: var TerminalBuffer, state: var ScreenState) =
|
||||
let w = terminalWidth()
|
||||
let h = terminalHeight()
|
||||
|
||||
tb.write(centerX("Run Clojure File", w), 1, fgCyan, "Run Clojure File")
|
||||
tb.write(centerX("Run Bara Lang File", w), 1, fgCyan, "Run Bara Lang File")
|
||||
tb.drawHorizLine(0, w - 1, 2, doubleStyle = true)
|
||||
|
||||
let valX = 12
|
||||
@@ -646,7 +646,7 @@ proc drawHelp*(tb: var TerminalBuffer, state: var ScreenState) =
|
||||
tb.drawHorizLine(0, w - 1, 2, doubleStyle = true)
|
||||
|
||||
let helpText = @[
|
||||
"Clojure/Nim TUI v0.1.0",
|
||||
"Bara Lang TUI v0.1.0",
|
||||
"",
|
||||
"Navigation:",
|
||||
" Arrow Keys / Tab Navigate menus and fields",
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Clojure Value Types (Compiler internal representation)
|
||||
# Bara Lang Value Types (Compiler internal representation)
|
||||
import sequtils, strutils
|
||||
|
||||
type
|
||||
|
||||
Reference in New Issue
Block a user