Add Common Lisp support - #1187
Closed
fade wants to merge 8 commits into
Closed
Conversation
Add an imperative tree-sitter-commonlisp walker that extracts packages, classes, functions, methods, macros, generic-function dispatch, and calls from Common Lisp source. Registered alongside the other custom extractors so homoiconic CL — where every defXXX form is the same list_lit node — is classified by reading definer symbols rather than tree-sitter node types. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
Emit docstring-derived rationale nodes with file_type "rationale" instead of "code" so the cross-file resolution filter excludes them, keeping docstrings out of import and symbol-resolution edges. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
Classify .lisp/.cl/.lsp/.asd as code and route them to the Common Lisp extractor so ASDF systems and source files build into the graph. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
Declare the Common Lisp grammar under optional-dependencies, matching the policy for other niche grammars, so the core install stays lean and Lisp users opt in with the commonlisp extra. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
Add the sample.lisp fixture and the Common Lisp extraction tests covering packages, classes, defuns, generics, macros, method specializers, inheritance, imports, custom definers, reader conditionals, and docstring rationale typing. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
The latest tree-sitter-commonlisp release returns an int pointer that the tree-sitter runtime only accepts via a deprecated path, so extracting Lisp spewed a DeprecationWarning per file. Suppress that one warning at the construction site so Lisp extraction runs clean. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
Move the Common Lisp extraction tests into the language-extractor suite where the project keeps per-language coverage, so they sit with their peers rather than in the general multi-language file. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
Surface Common Lisp in the supported-extensions table and add the commonlisp optional-extra row so users know the grammar exists and how to install it. 🄯 Brian O'Reilly <fade@deepsky.com>, 2026 Co-authored-by: jansaasman <ja@franz.com>
Author
|
Closing this in favour of #2274, which supersedes it. This branch had gone stale and conflicting against v8. The replacement is rebased onto Nothing is lost by closing this one; #2274 is the same feature, brought up to date. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Common Lisp as a supported language. graphify now extracts a structural
knowledge graph from
.lisp,.cl,.lsp, and.asdsources — packages, classes,functions, methods, macros, generic-function dispatch, struct/type/condition
definitions, custom definer forms, reader-conditional and wrapper-macro bodies, and
call edges.
The grammar (
tree-sitter-commonlisp) is wired as an optional extra(
graphifyy[commonlisp]), matching the policy for other niche grammars (sql,dm).Why
Common Lisp is a conspicuous gap for a class of users — Lisp/AllegroGraph shops,
scientific and systems CL projects — who otherwise can't graph their codebases.
Common Lisp is homoiconic: every
defun/defclass/defpackageparses to the samelist_litnode, so it can't be expressed through the declarativeLanguageConfig(which keys on tree-sitter node types). It needs a dedicated walker that classifies
forms by their definer symbol — provided here as a standalone
extract_commonlisp,registered in
_DISPATCHalongside the other custom extractors (extract_sql,extract_markdown).Credit
The extractor and its test suite originate from @jansaasman's earlier
#172, which was opened against the pre-rewrite line and never merged.
This PR rebases that work onto v8, brings it into conformity with the
current extraction schema and contribution conventions, and adds the
integration. Every commit carries their co-authorship.
What's included
extract_commonlispwalker +detect.py/_DISPATCHregistration for.lisp/.cl/.lsp/.asdtree-sitter-commonlispas an optional extra (kept out of core dependencies)tests/test_languages.py+tests/fixtures/sample.lispcommonlispextras rowReviewer notes
file_type="rationale"so the cross-file resolution filter excludes them, consistent with the Python extractor.
tree-sitter-commonlisp0.4.1 (latest) returns an int pointerthat
tree_sitter.Languageonly accepts via a deprecated path; that single warning issuppressed at the construction site with an explanatory comment. Glad to switch to a
capsule-based construction if/when the grammar ships one.
🄯 Brian O'Reilly fade@deepsky.com, 2026