No description
  • C 59.5%
  • Ruby 32.8%
  • Rust 4.1%
  • Java 1.9%
  • JavaScript 1.1%
  • Other 0.5%
Find a file
dependabot[bot] 46d92d04d7
Some checks failed
Test gems / build (push) Failing after 0s
Test gems / install source gem macos-latest jruby (push) Failing after 0s
Test gems / install source gem macos-latest truffleruby (push) Failing after 0s
Test gems / install source gem ubuntu-latest jruby (push) Failing after 0s
Test gems / install source gem ubuntu-latest truffleruby (push) Failing after 0s
Test gems / install source gem windows-latest jruby (push) Failing after 0s
Test gems / install source gem macos-latest 2.7 (push) Failing after 0s
Test gems / install source gem ubuntu-latest 2.7 (push) Failing after 0s
Test gems / install source gem windows-latest 2.7 (push) Failing after 0s
Test gems / install source gem macos-latest 3.0 (push) Failing after 0s
Test gems / install source gem ubuntu-latest 3.0 (push) Failing after 0s
Test gems / install source gem windows-latest 3.0 (push) Failing after 0s
Test gems / install source gem macos-latest 3.1 (push) Failing after 0s
Test gems / install source gem ubuntu-latest 3.1 (push) Failing after 0s
Test gems / install source gem windows-latest 3.1 (push) Failing after 0s
Test gems / install source gem macos-latest 3.2 (push) Failing after 0s
Test gems / install source gem ubuntu-latest 3.2 (push) Failing after 0s
Test gems / install source gem windows-latest 3.2 (push) Failing after 0s
Test gems / install source gem macos-latest 3.3 (push) Failing after 0s
Test gems / install source gem ubuntu-latest 3.3 (push) Failing after 0s
Test gems / install source gem windows-latest 3.3 (push) Failing after 0s
Test gems / install source gem macos-latest 3.4 (push) Failing after 0s
Test gems / install source gem ubuntu-latest 3.4 (push) Failing after 0s
Test gems / install source gem windows-latest 3.4 (push) Failing after 0s
Test gems / install source gem macos-latest 4.0 (push) Failing after 0s
Test gems / install source gem ubuntu-latest 4.0 (push) Failing after 0s
Test gems / install source gem windows-latest 4.0 (push) Failing after 0s
Test gems / install source gem macos-latest head (push) Failing after 0s
Test gems / install source gem ubuntu-latest head (push) Failing after 0s
Test gems / install source gem windows-latest head (push) Failing after 0s
Test gems / install native gem arm-linux-gnu 3.3 (push) Failing after 0s
Test gems / install native gem arm-linux-gnu 3.4 (push) Failing after 0s
Test gems / install native gem arm-linux-gnu 4.0 (push) Failing after 0s
Test gems / install native gem aarch64-linux-gnu 3.3 (push) Failing after 0s
Test gems / install native gem aarch64-linux-gnu 3.4 (push) Failing after 0s
Test gems / install native gem aarch64-linux-gnu 4.0 (push) Failing after 0s
Test gems / install native gem arm-linux-musl 3.3 (push) Failing after 0s
Test gems / install native gem arm-linux-musl 3.4 (push) Failing after 0s
Test gems / install native gem arm-linux-musl 4.0 (push) Failing after 0s
Test gems / install native gem aarch64-linux-musl 3.3 (push) Failing after 0s
Test gems / install native gem aarch64-linux-musl 3.4 (push) Failing after 0s
Test gems / install native gem aarch64-linux-musl 4.0 (push) Failing after 0s
Test gems / install native gem x86_64-linux-musl 3.3 (push) Failing after 0s
Test gems / install native gem x86_64-linux-musl 3.4 (push) Failing after 0s
Test gems / install native gem x86_64-linux-musl 4.0 (push) Failing after 0s
Test gems / install native gem x86_64-linux-gnu 3.3 (push) Failing after 0s
Test gems / install native gem x86_64-linux-gnu 3.4 (push) Failing after 0s
Test gems / install native gem x86_64-linux-gnu 4.0 (push) Failing after 0s
Test gems / install native gem arm64-darwin 3.3 (push) Failing after 0s
Test gems / install native gem arm64-darwin 3.4 (push) Failing after 0s
Test gems / install native gem arm64-darwin 4.0 (push) Failing after 0s
Test gems / install native gem x86_64-darwin 3.3 (push) Failing after 0s
Test gems / install native gem x86_64-darwin 3.4 (push) Failing after 0s
Test gems / install native gem x86_64-darwin 4.0 (push) Failing after 0s
Test gems / install native gem aarch64-mingw-ucrt 3.4 (push) Failing after 0s
Test gems / install native gem aarch64-mingw-ucrt 4.0 (push) Failing after 0s
Test gems / install native gem x64-mingw-ucrt 3.3 (push) Failing after 0s
Test gems / install native gem x64-mingw-ucrt 3.4 (push) Failing after 0s
Test gems / install native gem x64-mingw-ucrt 4.0 (push) Failing after 0s
Test gems / source gem (push) Failing after 0s
Test gems / setup (push) Failing after 0s
Test gems / native gem aarch64-linux-gnu (push) Failing after 0s
Test gems / native gem aarch64-linux-musl (push) Failing after 0s
Test gems / native gem aarch64-mingw-ucrt (push) Failing after 0s
Test gems / native gem arm-linux-gnu (push) Failing after 0s
Test gems / native gem arm-linux-musl (push) Failing after 0s
Test gems / native gem arm64-darwin (push) Failing after 0s
Test gems / native gem x64-mingw-ucrt (push) Failing after 0s
Test gems / native gem x86_64-darwin (push) Failing after 0s
Test gems / native gem x86_64-linux-gnu (push) Failing after 0s
Test gems / native gem x86_64-linux-musl (push) Failing after 0s
CRuby bindings / test-all (parse.y) (push) Has been cancelled
CRuby bindings / test-all (prism) (push) Has been cancelled
Documentation / check (push) Has been cancelled
GitHub pages / build (push) Has been cancelled
JavaScript bindings / build (push) Has been cancelled
Main / lint (push) Has been cancelled
Main / template (push) Has been cancelled
Main / typecheck (push) Has been cancelled
Main / build (macos-latest) (push) Has been cancelled
Main / build (ubuntu-24.04-arm) (push) Has been cancelled
Main / build (ubuntu-latest) (push) Has been cancelled
Main / build (windows-latest) (push) Has been cancelled
Main / build-ibm (ubuntu-24.04-ppc64le) (push) Has been cancelled
Main / build-ibm (ubuntu-24.04-s390x) (push) Has been cancelled
Main / build-ffi (map[gemfile:.. ruby:jruby]) (push) Has been cancelled
Main / build-ffi (map[gemfile:.. ruby:truffleruby]) (push) Has been cancelled
Main / build-ffi (map[gemfile:4.1 ruby:head]) (push) Has been cancelled
Main / build-without-assertions (ubuntu-22.04) (push) Has been cancelled
Main / build-without-assertions (ubuntu-24.04) (push) Has been cancelled
Main / build-debug (macos-latest) (push) Has been cancelled
Main / build-debug (ubuntu-24.04-arm) (push) Has been cancelled
Main / build-debug (ubuntu-latest) (push) Has been cancelled
Main / build-debug (windows-latest) (push) Has been cancelled
Main / build-minimal (push) Has been cancelled
Main / build-with-various-compilers (push) Has been cancelled
Main / build-java (push) Has been cancelled
Main / build-java-truffleruby (push) Has been cancelled
Main / lex-ruby (push) Has been cancelled
Main / lex-discourse (push) Has been cancelled
Main / lex-top-100 (push) Has been cancelled
Main / memcheck (push) Has been cancelled
Main / gcc-analyzer (push) Has been cancelled
Main / clang-analyzer (push) Has been cancelled
Sync ruby / Sync ruby (push) Has been cancelled
GitHub pages / deploy (push) Has been cancelled
Bump the ruby-deps group across 8 directories with 1 update
Bumps the ruby-deps group with 1 update in the /gemfiles/2.7 directory: [parser](https://github.com/whitequark/parser).
Bumps the ruby-deps group with 1 update in the /gemfiles/3.0 directory: [parser](https://github.com/whitequark/parser).
Bumps the ruby-deps group with 1 update in the /gemfiles/3.1 directory: [parser](https://github.com/whitequark/parser).
Bumps the ruby-deps group with 1 update in the /gemfiles/3.2 directory: [parser](https://github.com/whitequark/parser).
Bumps the ruby-deps group with 1 update in the /gemfiles/3.3 directory: [parser](https://github.com/whitequark/parser).
Bumps the ruby-deps group with 1 update in the /gemfiles/3.4 directory: [parser](https://github.com/whitequark/parser).
Bumps the ruby-deps group with 1 update in the /gemfiles/4.0 directory: [parser](https://github.com/whitequark/parser).
Bumps the ruby-deps group with 1 update in the /gemfiles/4.1 directory: [parser](https://github.com/whitequark/parser).


Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

Updates `parser` from 3.3.11.1 to 3.3.12.0
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.11.1...v3.3.12.0)

---
updated-dependencies:
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
- dependency-name: parser
  dependency-version: 3.3.12.0
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ruby-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-20 16:26:54 -04:00
.github Bump actions/setup-node from 6 to 7 in the action-deps group 2026-07-20 16:26:19 -04:00
bin Add native gem precompilation support 2026-07-17 12:24:21 -04:00
cpp Cleanup 2026-03-18 15:39:42 -04:00
doc Better documentation website 2026-03-20 14:03:20 -04:00
docs Add native gem precompilation support 2026-07-17 12:24:21 -04:00
ext/prism Fix up buffer treatment of stream parsing 2026-07-15 13:53:47 -04:00
fuzz Make buffer an opaque pointer 2026-03-18 15:38:47 -04:00
gemfiles Bump the ruby-deps group across 8 directories with 1 update 2026-07-20 16:26:54 -04:00
include Fix up buffer treatment of stream parsing 2026-07-15 13:53:47 -04:00
java Bump org.junit.jupiter:junit-jupiter-engine (#4168) 2026-07-13 19:17:10 +02:00
javascript Make buffer an opaque pointer 2026-03-18 15:38:47 -04:00
lib Move deprecated into node_ext 2026-07-20 09:05:39 -04:00
rakelib Rename some keyword locations for consistency 2026-07-20 08:29:20 -04:00
rbi Rename some keyword locations for consistency 2026-07-20 08:29:20 -04:00
rust Allow custom C flags in ruby-prism-sys 2026-07-14 14:50:58 -04:00
sample/prism Optimize ruby visitor 2025-12-23 14:41:09 +01:00
sig Remove excess rbs file 2026-07-20 21:30:02 +02:00
snapshots Rename some keyword locations for consistency 2026-07-20 08:29:20 -04:00
src Fix stack-use-after-return with unterminated heredocs 2026-07-18 16:35:05 -04:00
suppressions Suppress valgrind ripper leak 2024-06-04 11:19:53 -04:00
templates Add location slice to deconstruct_keys 2026-07-10 12:23:56 -04:00
test/prism Fix pattern matching trailing comma 2026-07-17 15:54:21 -04:00
.editorconfig Set .editorconfig for .java and .java.erb 2024-02-28 18:45:37 +01:00
.git-blame-ignore-revs Ignore the formatting commits in git blame 2023-06-02 15:56:34 -04:00
.gitattributes Typecheck _Visitor as Visitor 2026-02-25 08:38:09 -05:00
.gitignore Add native gem precompilation support 2026-07-17 12:24:21 -04:00
BSDmakefile Include BSDmakefile 2024-03-04 11:15:20 -05:00
CHANGELOG.md Sync changelog 2026-03-17 13:20:39 +01:00
CODE_OF_CONDUCT.md More docs 2022-12-21 09:33:17 -05:00
config.yml Rename some keyword locations for consistency 2026-07-20 08:29:20 -04:00
CONTRIBUTING.md Update CONTRIBUTING guidelines based on truffleruby 2024-05-24 10:14:06 -04:00
Doxyfile Clean up documentation 2026-03-18 15:39:43 -04:00
Gemfile Add native gem precompilation support 2026-07-17 12:24:21 -04:00
Gemfile.lock Add native gem precompilation support 2026-07-17 12:24:21 -04:00
LICENSE.md More docs 2022-12-21 09:33:17 -05:00
Makefile Generate templated sources under main/java-templates 2026-03-31 15:18:49 -05:00
prism.gemspec Move deprecated into node_ext 2026-07-20 09:05:39 -04:00
Rakefile Add native gem precompilation support 2026-07-17 12:24:21 -04:00
README.md Add MRuby to runtimes list 2026-07-18 13:48:19 -04:00
Steepfile rbs-inline 2026-02-25 08:38:09 -05:00

Prism Ruby parser

Prism Ruby parser

This is a parser for the Ruby programming language. It is designed to be portable, error tolerant, and maintainable. It is written in C99 and has no dependencies.

Overview

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

.
├── Makefile              configuration to compile the shared library and native tests
├── Rakefile              configuration to compile the native extension and run the Ruby tests
├── bin
│   ├── lex               runs the lexer on a file or string, prints the tokens, and compares to ripper
│   ├── parse             runs the parse on a file or string and prints the AST
│   └── prism             a CLI for development and debugging
├── config.yml            specification for tokens and nodes in the tree
├── doc                   documentation website
├── docs                  markdown documentation about the project
├── ext
│   └── prism
│       ├── extconf.rb    configuration to generate the Makefile for the native extension
│       └── extension.c   the native extension that interacts with libprism
├── fuzz                  files related to fuzz testing
├── gemfiles              gemfiles used by different Ruby versions in CI
├── include
│   ├── prism             header files for the shared library
│   └── prism.h           main header file for the shared library
├── java
|   ├── api               Java API for Prism
|   ├── native            Java native bindings for the shared library
|   └── wasm              Java WASM bindings for the shared library
├── javascript            JavaScript WASM bindings for the shared library
├── lib
│   ├── prism             Ruby library files
│   └── prism.rb          main entrypoint for the Ruby library
├── rakelib               various Rake tasks for the project
├── rbi                   RBI type signatures for the Ruby library
├── rust
│   ├── ruby-prism        Rustified crate for the shared library
│   └── ruby-prism-sys    FFI binding for Rust
├── sample
│   └── prism             Sample code that uses the Ruby API for documentation purposes
├── sig                   RBS type signatures for the Ruby library
├── src
│   └── prism.c           main entrypoint for the shared library
├── templates             contains ERB templates generated by templates/template.rb
│   └── template.rb       generates code from the nodes and tokens configured by config.yml
└── test
    └── prism
        ├── fixtures      Ruby code used for testing
        └── snapshots     snapshots of generated syntax trees corresponding to fixtures

Getting started

To compile the shared library, you will need:

  • C99 compiler
  • GNU make
  • Ruby 2.7.0 or later

Once you have these dependencies, run:

bundle install

to fetch the Ruby dependencies. Finally, run:

bundle exec rake compile

to compile the shared library. It will be built in the build directory. To test that everything is working, run:

bin/parse -e "1 + 2"

to see the syntax tree for the expression 1 + 2.

Contributing

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

Examples

Prism has been integrated into the majority of Ruby runtimes, many libraries, and some applications. Below is a list of some of the projects that use Prism:

Runtimes

Libraries

Applications