Files
mruby-mruby/mrbgems/mruby-bin-mruby
Yukihiro "Matz" Matsumoto 613b03ac18 mruby-compiler: add no_return_value context flag for script optimization
when running scripts via mruby -e or file, return values are unused.
this adds a no_return_value flag to skip generating unnecessary code.

for parallel assignment like a,b = 1,2:
- before: 18 bytes, 5 registers, creates temporary array
- after: 5 bytes, 3 registers, direct register assignment, no RETURN

the flag is set only for the main program, not for libraries loaded
with -r option. eval() and mirb continue returning values correctly.

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-21 17:26:49 +09:00
..

mruby-bin-mruby

mruby is the main interpreter for executing Ruby scripts with mruby.

Usage

mruby [switches] [programfile] [arguments]

Options

  • -b - load and execute RiteBinary (mrb) file
  • -c - check syntax only
  • -d - set debugging flags (set $DEBUG to true)
  • -e 'command' - one line of script
  • -r library - load the library before executing your script
  • -v - print version number, then run in verbose mode
  • --verbose - run in verbose mode
  • --version - print the version
  • --copyright - print the copyright

Examples

# Execute a Ruby script
mruby script.rb

# Execute inline code
mruby -e 'puts "Hello, mruby!"'

# Check syntax without executing
mruby -c script.rb

# Execute a compiled binary
mruby -b script.mrb

# Load a library before running script
mruby -r mruby-io script.rb

# Pass arguments to script
mruby script.rb arg1 arg2

License

MIT License - see the mruby LICENSE file.