go-ruby-parser
A Ruby front-end in pure Go. Lexer, parser, AST — no cgo, no Prism.
go-ruby-parser turns Ruby source into an AST: a stateful lexer, a recursive-descent parser with a Pratt expression core, and a typed syntax tree — all in pure Go, with cgo disabled. It is the front-end the Go ecosystem lacked for building Ruby tooling (linters, formatters, analysers, doc generators, LSP servers, transpilers) without shelling out to Ruby or binding Prism.
It was extracted from the go-embedded-ruby interpreter — which now consumes it — and is grown test-first against MRI Ruby 4.0.5, with 100% coverage enforced in CI across the six 64-bit targets.
Why go-ruby-parser
Building Ruby tooling in Go used to mean shelling out to a Ruby process, binding Prism (Ruby's official parser, written in C) over cgo, or reimplementing the grammar from scratch. go-ruby-parser is a faithful, pure-Go Ruby front-end — lexer, parser and AST — so a Go program can parse Ruby to a typed syntax tree with no cgo and a single static binary. It is the parser the Go ecosystem was missing.
Repositories
parser
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 parser with a scope stack, and a typed AST. 100% covered, differential-tested against MRI 4.0.5.
docs
Documentation site (MkDocs Material): the public API, what's parsed, and the known limitations. Source →
brand
Logos and icons for the organization, in SVG / PNG / JPG / ICO / ICNS across colour, white and black variants.
Quality bar
- Pure Go.
CGO_ENABLED=0— no cgo, no Prism, no Ruby process. - 100% test coverage. Gated in CI; the grammar is differential-tested against MRI Ruby 4.0.5.
- Reusable. A clean
Parse → *ast.ProgramAPI any Go tool can build on (linters, formatters, LSP, doc generators). - Multi-arch. Validated on all six 64-bit Go targets (amd64, arm64, riscv64, loong64, ppc64le, s390x).
- BSD-3-Clause on every source file.