feat(lang): Add Clojure language support#80
Conversation
Add comprehensive Clojure parser using tree-sitter-clojure-orchard. **New Files:** - src/parsing/clojure/mod.rs - Module exports - src/parsing/clojure/definition.rs - ClojureDefinition impl - src/parsing/clojure/parser.rs - AST parsing & symbol extraction - src/parsing/clojure/behavior.rs - Runtime behavior tracking - src/parsing/clojure/resolution.rs - Cross-reference resolution - src/parsing/clojure/audit.rs - Code health analysis **Features:** - Extracts defn, defmacro, def, defmulti, defmethod, defprotocol, defrecord - Handles namespaced symbols and qualified references - Tracks function calls and dependencies - Supports docstrings and metadata extraction - Pattern-based form detection (Clojure grammar is syntax-only) **Dependencies:** - tree-sitter-clojure-orchard = "0.2.5" **Documentation:** - contributing/parsers/clojure/IMPLEMENTATION_GUIDE.md Tested with hive-mcp codebase: 13,324 symbols indexed successfully. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Hi @BuddhiLW Thank you for your contribution! A significant update was merged that includes API changes likely to cause conflicts with your branch. What's changed:
Please rebase on main. Happy to assist if you encounter any issues. |
|
Hi! I will be happy to conciliate with updates. Thank you for considering the PR. One idea I had, because tree-sitter is limited for lisps, I may write a rust module wrapper to use clj-kondo. I have some thoughts. Because, it will help greatly with token-efficiency in my other project (hive-mcp); and behavior normalization. When I have 5+ claudes and 3+ free models per claude doing work, like refactoring etc. Sometimes free models will have way less context and hallucinate on function annotations ("types" for clojure) - I noticed. So, yeah. Let's see... Nice talking to you, anyway. |
- Clojure parser: defn, def, defmacro, defprotocol, defrecord, deftype, defmulti, defmethod, ns - tree-sitter-clojure-orchard 0.2.5 grammar (codeberg.org/grammar-orchard) - 7 symbol kinds extracted: Function, Variable, Macro, Interface, Struct, Method, Module - comprehensive.clj: 520 lines, 34/35 grammar nodes covered - ABI audit test and grammar analysis artifacts - compare-nodes.sh language-mode: node extraction from GRAMMAR_ANALYSIS.md - Based on BuddhiLW contribution, rebased and updated for current API Co-authored-by: BuddhiLW <[email protected]>
- Clojure parser: defn, def, defmacro, defprotocol, defrecord, deftype, defmulti, defmethod, ns - tree-sitter-clojure-orchard 0.2.5 grammar (codeberg.org/grammar-orchard) - 7 symbol kinds extracted: Function, Variable, Macro, Interface, Struct, Method, Module - comprehensive.clj: 520 lines, 34/35 grammar nodes covered - ABI audit test and grammar analysis artifacts - compare-nodes.sh language-mode: node extraction from GRAMMAR_ANALYSIS.md - Based on BuddhiLW contribution, rebased and updated for current API Co-authored-by: BuddhiLW <[email protected]>
|
Hey thanks for putting this together. I reworked parts of the parser, behavior, and audit modules to align with some conventions and refactors that landed after you opened the PR. Also added the grammar analysis artifacts and test fixtures. So closing this, your work is already in main. |
|
That's awesome. Thanks. I left this behind |
Summary
Add comprehensive Clojure language support using
tree-sitter-clojure-orchard.Changes
New Parser Module:
src/parsing/clojure/mod.rs- Module exportsdefinition.rs- ClojureDefinition implementationparser.rs- AST parsing & symbol extraction (30KB)behavior.rs- Runtime behavior trackingresolution.rs- Cross-reference resolutionaudit.rs- Code health analysisIntegration:
Cargo.tomlwithtree-sitter-clojure-orchard = "0.2.5"factory.rs,language.rs,registry.rs.clj,.cljs,.cljc,.ednextensionsFeatures
defn,defmacro,def,defmulti,defmethod,defprotocol,defrecord,nsTesting
Tested with hive-mcp codebase:
Documentation
Added
contributing/parsers/clojure/IMPLEMENTATION_GUIDE.md(1400 lines) with:Notes
The Clojure tree-sitter grammar is syntax-only (no semantic nodes for
defnetc.), so the parser uses pattern matching on list forms to identify definitions. This approach is documented in the implementation guide.🤖 Generated with Claude Code