Dec 2022 Update: You may want to check out sogaiu tree-sitter-clojure. I believe it is the most complete tree-sitter grammar for Clojure.
This repo contains a tree-sitter grammar for Clojure and ClojureScript.
Tree-sitter is an ambitious new library for language syntax highlighting being used by the Atom editor and GitHub.com. Tree-sitter uses language grammars instead of regular expressions and supports fast updates as the user is typing (similar to many persistent data structure operations in Clojure).
You can read more about tree-sitter on the website.
- Clojure, ClojureScript, and
.cljc
as first class citizens - When in doubt, be more specific
- we may put more information than strictly required into the AST
- this gives editors / integrations the option to highlight what they want
No. Tree-sitter is open source and has bindings to C, so it can be used in many environments.
Unfortunately, there is not a "one size fits all" solution here.
Every integration will be different, depending largely on how the target environment / tool supports syntax highlighting, extensions, etc. Please see the documentation for your editor and the tree-sitter source for more information.
Make sure Node.js and npm are installed, then from the command line:
# first-time install step:
# > creates the node_modules folder
# > builds tree-sitter
npm install
# build the grammar
npm run build
# test the corpus
npm run test
Please see the installing the tools section on the tree-sitter website for more information. This comment may also be helpful in getting started.