goruby

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: MIT

README

goruby

GitHub go.mod Go version GitHub Tag lint_and_test Go Report Card

An implementation of a subset of Ruby in Go. The goal is to be able to run Pyramid-Scheme.

This project began as a fork of goruby/goruby and has since diverged.

Build

make build       # ./bin/goruby, ./bin/girb, ./bin/grgr

Commands

goruby

Run a Ruby file (or one-line scripts via -e):

goruby program.rb
goruby -e 'puts "hello"'
goruby -e 'x = 1' -e 'puts x'

Flags: --cpuprofile, -e, --trace-parse, --trace-eval, -v/--version.

girb

Interactive REPL with multiline expressions and readline support. CTRL-D exits.

girb

Flags: --noecho, --noprompt, -v/--version.

grgr

AST-printer / round-trip tool. Parses a Ruby file, runs the transformer pass, and prints the recovered source with debug comments.

grgr program.rb

Flags: --trace-transform, -v/--version.

Layout

  • cmd/gorubygoruby binary entry point
  • cmd/girbgirb REPL entry point
  • cmd/grgrgrgr AST-printer entry point
  • ast — AST node definitions
  • lexer — tokeniser
  • parser — parser, produces an ast.Program
  • transformer — AST rewrite passes
  • evaluator — tree-walking evaluator
  • interpreter — top-level glue used by cmd/goruby
  • object — runtime object model (Integer, String, Array, Hash, Proc, ...)
  • repl — REPL loop used by girb
  • token — token type and source positions
  • trace — parse / eval trace helpers
  • internal/version — generated build-info (Version, CommitSHA, BuildDate, BuildInfo)

Versioning

VERSION is the source of truth. make build and make test regenerate internal/version/version.go via lczyk/version so each binary's --version reports the current version, commit SHA, build date, and dirty-tree marker.

Licence

MIT — see LICENSE. Upstream copyright from the goruby/goruby fork is preserved at LICENSE-goruby.

Directories

Path Synopsis
ast
cmd
girb command
goruby command
grgr command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL