goruby

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/goruby — goruby binary entry point
cmd/girb — girb REPL entry point
cmd/grgr — grgr 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.