Skip to content

Copy in Aether's parser as the new air_r_parser - #548

Merged
DavisVaughan merged 20 commits into
mainfrom
feature/aether-swap
Oct 22, 2026
Merged

DavisVaughan merged 20 commits into
mainfrom
feature/aether-swap

Conversation

@DavisVaughan

@DavisVaughan DavisVaughan commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Related preliminary PRs that led up to this one:
#533
#534
#535
#536
#537
#538
#543
#544
#545
#546
#547

These PRs were important because they allowed us to shift the Air syntax tree one step at a time, even though tree-sitter-r was still the backend. Because of that, this PR has 0 changes to formatting snapshots.

Aether was crafted with blood, sweat, and tears here https://github.com/DavisVaughan/aether. This repo will be marked read only, as it has been absorbed into Air now.


This PR switches us to Aether's new Top Down Pratt parser for R, written entirely in Rust with no dependency on tree-sitter-r (or C!!!!) whatsoever. This switch has a number of important benefits:

  • It is 7x faster at parsing than the tree-sitter-r approach. This is important for Air and gives us 2x faster formatting, but will also be great for Jarl and Ark which also have to parse a lot of R files!

  • It means C is no longer in the Air dependency chain. So we should be able to compile to WASM wayyyy easier now. Possibly q2 or wasm-r could use Air easily now.

  • It means we are fully in control of both error recovery and error reporting. We are going to have much improved error reporting and should be able to report both the exact problem and the surrounding code snippet (surfacing this is still a follow up PR). We also are much better at error recovery because we control it precisely and have much more context available to us to recover per-concept (error recovery for calls is different from error recovery for function definitions, for example). I still don't think we are error resilient enough to perform formatting on broken files, but we might be able to do inference on them.

  • It dropped 1.2 MB from the binary (10 MB -> 8.8 MB)


The parser tests use a new markdown style testing scheme, and brings over EVERY SINGLE TEST from both tree-sitter-r and the previous air parser tests, so I am extremely confident in them.

Additionally, I did an "ecosystem check" against the following repos, and nothing changed! So that's great.

  • tidyverse/dplyr
  • tidyverse/tidyr
  • rstudio/shiny
  • r-lib/rlang
  • r-lib/vctrs
  • rdatatable/data.table
  • ropensci/targets

Originally I thought it might be nice if aether lived on its own, and on the air side we just depended on it. And that still might be nice in the future! But for now it doesn't give us many practical benefits besides being a project that stands alone, and it came with a number of headaches:

  • xtasks/ were coupled because biome's tooling expects the parser and formatter to live together in the same repo. We will want to update the xtask code from upstream biome in the future too, so rewriting them too much would be painful
  • If we need to change things in aether, it basically requires 2 (or 3) PRs. One in aether, air, and possibly ark, depending on the change
  • It made this PR even more complicated than it already is to try and do this split at once

We can tell people they can use air_r_parser as Jarl already does without really needing aether on its own yet. And now that it's in air, it's much easier to split back out into a standalone aether if we want to, rather than doing the split + rewrite all at once.

@DavisVaughan
DavisVaughan merged commit 79cc4d0 into main Oct 22, 2026
7 checks passed
@DavisVaughan
DavisVaughan deleted the feature/aether-swap branch October 22, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant