go-ruby-parser turns Ruby source into a syntax tree: a stateful lexer,
a recursive-descent parser with a Pratt expression core, and a typed AST โ
all in pure Go, with cgo disabled. No cgo, no Prism, no
shelling out to Ruby: the front-end the Go ecosystem lacked for building Ruby tooling
(linters, formatters, analysers, doc generators, LSP servers, transpilers) in pure Go.
It was extracted from go-embedded-ruby โ
which now consumes it โ and is grown test-first against MRI Ruby 4.0.5.
100% coverage is enforced in CI on all three OS lanes, and the suite also runs
on all six 64-bit targets โ amd64 and arm64 natively, riscv64 / loong64 /
ppc64le / s390x under QEMU โ plus js/wasm and wasip1/wasm.
The current release is v0.4.0
(2026-09-26). Measured on 2026-09-26: all 80 _spec.rb files in the
pinned ruby/spec language/ corpus parse, and of 47 top-level CRuby 4.0.5 stdlib
files MRI accepts, this parser accepts 46. On parse speed it is roughly
1.9ร quicker than Ripper.sexp and about
1.6ร slower than the C parser built into CRuby
(RubyVM::AbstractSyntaxTree.parse).
The front-end: parser.Parse(src) (*ast.Program, error), with sub-packages token, ast and lexer. A stateful lexer (MRI spaceSeen semantics), a recursive-descent + Pratt expression parser with a scope stack, and a typed AST for a broad, practical subset of Ruby 4.0 โ literals, operators, control flow, case/in pattern matching, methods/blocks, classes/modules/metaprogramming. 100% covered (the gate runs on all three OS lanes; the suite also runs on all six 64-bit targets and on js/wasm and wasip1/wasm), differential-tested against MRI Ruby 4.0.5. Current release v0.4.0 (2026-09-26): all 80 _spec.rb files in the pinned ruby/spec language/ corpus parse, and the three limitations the docs used to list โ paren-less command calls with keyword/splat/block args, default block parameters, and the positional Class(a) find-pattern โ all parse now. BEGIN { } / END { } remain the one refusal.
A pure-Go, cgo-disabled front-end, so it cross-compiles and embeds
anywhere โ and, being CGO=0, also compiles to WebAssembly (js/wasm and
wasip1/wasm). It parses a broad, practical subset of Ruby 4.0 to a typed AST,
differential-tested against MRI's reference parser, over a clean
Parse โ *ast.Program API any Go tool can build on. It is a standalone, reusable
module and the front-end member of the sibling family
go-ruby-marshal ยท
go-ruby-regexp, consumed by
github.com/go-embedded-ruby.