Rewriting the Ruby parser

Open link in next tab

Rewriting the Ruby parser

https://railsatscale.com/2023-06-12-rewriting-the-ruby-parser/

At Shopify, we have spent the last year writing a new Ruby parser, which we’ve called YARP (Yet Another Ruby Parser). As of the date of this post, YARP can parse a semantically equivalent syntax tree to Ruby 3.3 on every Ruby file in Shopify’s main codebase, GitHub’s main codebase, CRuby, and the 100 most popular gems downloaded from rubygems.org. We recently got approval to merge this work into CRuby, and are very excited to share our work with the community. This post will take you through the motivations behind this work, the way it was developed, and the path forward.

Shopify wrote a new hand-written recursive descent parser. This looks like it will be a great improvement to the Ruby ecosystem!