[This article was first published on rOpenSci - open tools for open science, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.A little bit less than two years ago, building on work by Jim Hester and Kevin Ushey, Davis Vaughan completed a very impactful JavaScript file for the R community: an R grammar for the Tree-sitter parsing generator. He even got a round of applause for it during a talk at the useR! 2024 conference! So, did he get cheered for… grammatical rules in a JavaScript file? No, the audience was excited about the improved developer experience for R that this file unlocked. R tooling around Tree-sitter is how you getreformatting through Air and linting through Jarl;auto-completion or help on hover in the Positron IDE;better search for R on GitHub;and more!In this post, we’ll explain what Tree-sitter is, and how tools built on Tree-sitter can benefit your R development workflow.Code parsing: what is Tree-sitter?Tree-sitter is a code parsing generator written in C, with bindings existing in several languages including Rust (and R!).Let’s rewind a little bit. What does it mean to parse code?Basically, given a string of code likea getParseData()#> line1 col1 line2 col2 id parent token terminal text#> 23 1 1 1 26 23 0 expr FALSE #> 1 1 1 1 1 1 3 SYMBOL TRUE a#> 3 1 1 1 1 3 23 expr FALSE #> 2 1 3 1 4 2 23 LEFT_ASSIGN TRUE 21 1 6 1 26 21 23 expr FALSE #> 4 1 6 1 9 4 6 SYMBOL_FUNCTION_CALL TRUE mean#> 6 1 6 1 9 6 21 expr FALSE #> 5 1 10 1 10 5 21 '(' TRUE (#> 7 1 11 1 11 7 9 SYMBOL TRUE x#> 9 1 11 1 11 9 21 expr FALSE #> 8 1 12 1 12 8 21 ',' TRUE ,#> 13 1 14 1 18 13 21 SYMBOL_SUB TRUE na.rm#> 14 1 20 1 20 14 21 EQ_SUB TRUE =#> 15 1 22 1 25 15 16 NUM_CONST TRUE TRUE#> 16 1 22 1 25 16 21 expr FALSE #> 17 1 26 1 26 17 21 ')' TRUE )Or you could transform that same data into XML using Gábor Csárdi’s {xmlparsedata}:parse( text = "a