62ca70d05a
T4.5 nREPL: TCP-based JSON REPL (cljnim repl --tcp 9999)
T4.6 Tool-call: {"tool":"cljnim/eval","args":{"form":"..."}}
T7.3 Module caching: nimcache/ in project dir, skip regen if unchanged
Phase 4 now 100% complete. Phase 7: 3/4 tasks done.
3.6 KiB
3.6 KiB
Development Roadmap
Phase 0: Compiler Core ✅
- Clojure Reader (EDN parser)
- Reader supports: lists
(), vectors[], maps{}, strings, keywords, symbols, numbers, booleans, nil - Reader supports: quote
', syntax-quote`, unquote~, unquote-splicing~@ - Reader supports: comments
;, read-all - AST → Nim Emitter
- CLI (
compile,run,read,repl) - Special forms:
def,defn,fn,let,if,do,quote - Special forms:
when,cond - Arithmetic operators:
+,-,*,/ - Comparison operators:
=,not=,not,<,>,<=,>= - Core functions:
println,map,filter,reduce - Runtime type system:
CljValwithnil,bool,int,float,string,keyword,symbol,list,vector,map,fn,atom
Phase 1: Macro System ✅
macroexpand,macroexpand-1syntax-quote,unquote,unquote-splicinggensymdefmacro(user-defined macros)- Built-in macros:
->,->>,and,or,when,when-not,cond - Built-in macros:
cond->,cond->>,doto,as->,some->,some->> - Built-in macros:
for,doseq,dotimes - Built-in macros:
when-let,if-let - Built-in macros:
comment,assert,with-open
Phase 2: REPL & Tooling ✅
- Human REPL (
:help,:defs,:clear,:ns,:quit) - JSON REPL (
--json) with structured I/O - Batch evaluation (
eval-batch) - Structured errors (type, message, form, line)
- Session persistence for
def/defndefinitions
Phase 3: Nim Interop ✅
- Call Nim functions:
(nim/math/sin x),(nim/strutils/toUpper s) - C FFI via Nim
importc
Phase 4: AI-Native Tooling ✅
- File operations:
(file/read "path"),(file/write "path" "content"),(file/append "path" "content") - File operations:
(file/ls "dir"),(file/exists? "path") - Git operations:
(git/status),(git/commit "msg"),(git/push) - Git operations:
(git/diff),(git/log) - nREPL protocol compatibility (JSON over TCP,
--tcp PORT) - Tool-call format for AI framework integration
Phase 5: Persistent Data Structures ✅ (Complete)
- Persistent Vector (Hash Array Mapped Trie, 32-way branching)
- Persistent Map (HAMT) —
pmapAssoc,pmapDissoc,pmapGetin O(log₃₂ n) - Persistent Set — backed by HAMT map,
conj/disj/contains?/get conj,assoc,dissoc,get,get-innth,first,rest,last,counton persistent collections- Transients for batch mutations
conj!,assoc!,persistent!
Phase 6: Clojure Core Library ✅ (Complete)
range(0/1/2/3 args),repeat,cycle,iteratetake,drop,partition,interleave,concatstr,pr-str,println,prnslurp,spit,read-linemeta,with-meta,vary-metatype,instance?,satisfies?
Phase 7: Project Compilation
- Compile entire projects (not just single files)
- Namespace system (
ns,(:require [lib :as alias])) - Module caching for faster REPL startup
- Dependency resolution (deps.edn, Git deps)
Phase 8: Self-Hosted REPL
- Compile forms in memory (no temp files)
- Fast REPL startup (< 100ms)
- Hot code reloading
Phase 9: Concurrency
- Atoms (compare-and-swap)
- Agents
- core.async channels (simplified)
Known Issues
->>threading macro with nestedmap/reducerequires proper macro expansion context- REPL definitions are re-compiled from scratch on each evaluation (slow but correct)