Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Yet Another Ruby Parser

This is an early work-in-progress project geared at replacing the existing CRuby parser. Its aims are threefold:

  • Portability - we want the ability to use this parser in other projects, implementations, and tools.
  • Error tolerance - we want this parser to be able to recover from as many syntax errors as possible.
  • Maintainability - we want this to be a long-standing project with good hygiene. This means tutorials, examples, documentation, clean code, good test coverage, etc.


This link is where you can find the design document for the project. It is also a work-in-progress, but should give you a good sense of the overall goals and motivations.

There are many parsers that have been built before in various stages of upkeep. Below is a list of the ones I have read through and found useful:

There are also a couple of tools that define node shapes for every kind of node in the Ruby syntax tree. I've taken inspiration from those tools as well. They include most of the parsers above, as well as:


The repository contains the infrastructure for both a shared library (librubyparser) and a native Ruby extension. The shared library has no bindings to Ruby itself, and so can be used by other C libraries. The native Ruby extension links against ruby.h, and so is suitable in the context of Ruby.

├── Makefile              configuration to compile the shared library and native tests
├── Rakefile              configuration to compile the native extension and run the Ruby tests
├── bin
│   ├── template          generates code from the nodes and tokens configured by config.yml
│   └── templates         directory containing all of the various templates
├── config.yml            specification for tokens and nodes in the tree
├── ext
│   └── yarp
│       └── extension.c   the native extension that interacts with librubyparser
├── lib
│   ├── yarp              support files for the Ruby library
│   └── yarp.rb           main entrypoint into the Ruby library
├── src
│   ├── yarp.c            main entrypoint into the shared library
│   └── yarp.h            main header file for the shared library
└── test                  Ruby tests for the Ruby library


See the file for more information. We additionally have documentation about the overall design of the project as well as various subtopics.

VSCode Extension

See the vscode/ file for more information and installation instructions.