Skip to content

lczyk/goruby

 
 

Repository files navigation

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.

About

An implementation of *A SUBSET* of Ruby in Go for running Pyramid Scheme.

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE-goruby

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 95.6%
  • Ruby 3.8%
  • Makefile 0.6%