Skip to content

Add R parser support (.r, .R) #137

@josephismikhail

Description

@josephismikhail

Problem

Ix does not currently parse .r or .R files. R scripts are treated as unrecognized and excluded from analysis, meaning statistical analysis, data pipelines, and modeling code written in R are invisible to the system.

Proposed solution

Add an R parser that can identify and extract:

  • Function definitions (e.g. my_func <- function(x) { })
  • Variable assignments (e.g. <-, =, ->)
  • Library and package imports (e.g. library(), require())
  • Control flow (e.g. if, for, while)
  • Common data structures (vectors, lists, data frames)
  • Source calls (e.g. source("other_script.R"))

Support the following file patterns: *.r, *.R

Why it matters

R is the dominant language in data science, statistical research, and bioinformatics workflows. In repos that blend application code with analytical pipelines, R scripts often contain critical business logic for modeling and reporting. Without parsing R, Ix cannot reason about data workflows or how analytical code connects to the broader system.

Merge requirements

Before this can be merged to main, the following must pass:

  • Tested on 3 repos
  • No regressions on existing parsers (ix map on a known TS/JS repo, verify counts unchanged)
  • Unit + smoke tests pass (npm test in ix-cli)
  • Function definitions (<- function(...)) ingested as entities
  • Variable assignments (<-, =, ->) ingested
  • library() and require() calls resolved as import entities
  • source() calls resolved and linked to target file where possible
  • Both .r and .R file extensions ingested
  • CONTAINS chains correctly: file → function → nested function
  • ix text returns results with language: r
  • ix contains returns members for a known R script

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions