Repository navigation
Description
Summary
Graphify currently recognizes .R files but relies on semantic/LLM-based extraction rather than deterministic AST parsing. This limits the accuracy and reproducibility of the generated graph for R projects, particularly CRAN-style packages.
I would like to contribute native Tree-sitter-based support for R.
Motivation
R remains a major language in statistics, data science, epidemiology, and bioinformatics, with tens of thousands of open-source packages on CRAN and many active research codebases.
While semantic extraction provides a useful high-level understanding, a native parser would provide:
- Deterministic extraction
- Fully local analysis (no model required)
- Better reproducibility
- More accurate symbol and call relationships
- Faster indexing
- Improved support for large repositories
Proposed Scope (Initial PR)
To keep the implementation manageable, I propose starting with core language support only.
The initial implementation would extract:
- Function definitions (
<- function()and= function()) - Function calls
- Package-qualified calls (
pkg::fun,pkg:::fun) library()andrequire()imports- Source locations
- File/function relationships
The goal is to produce the same core graph entities available for other Tree-sitter-backed languages.
Future Enhancements
Once the core extractor is stable, additional R-specific features could be added incrementally, for example:
DESCRIPTIONparsingNAMESPACEparsing- Roxygen metadata
- Exported vs internal functions
testthatrelationships- S3 generic/method links
- S4 support
- R6 classes
- Vignettes and package structure
These would likely be separate follow-up PRs rather than part of the initial implementation.
Questions
Before starting implementation, I'd like to confirm:
- Would maintainers be interested in native Tree-sitter support for R?
- Is there any preferred architecture or extractor pattern I should follow beyond the existing language extractors?
- Are there any planned changes to the extraction pipeline that I should be aware of before beginning work?
If there is interest, I'd be happy to work on the initial implementation and submit a PR.
Activity