Harman Patil (Editor)

Mruby

Updated on
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Covid-19
Development status  Active
Operating system  Cross-platform
Written in  C and Ruby
Mruby
Developer(s)  Yukihiro Matsumoto et al.
Stable release  1.2.0 / November 18, 2015 (2015-11-18)
Type  Ruby programming language interpreter

mruby is an interpreter for the Ruby programming language with the intention of being lightweight and easily embeddable. The project is headed by Yukihiro Matsumoto, with over 100 contributors currently working on the project.

Contents

Features

mruby 1.0 supports the Ruby 2.1 core API but none of the standard library. As well as being able to execute most basic Ruby code, mruby also features a bytecode compiler and virtual machine, as well as the ability to be easily embedded and integrated into C or C++ code, in a similar manner to Lua or Tcl.

mruby also aims to be compliant with the ISO/IEC 30170:2012 standard.

Calling mruby from C

Assuming that you have mruby installed and in your path, the following program can be compiled and executed by running the following command from your terminal:

$ cc example.c -lmruby -lm -o example $ ./example

Precompiled Bytecode

mruby includes a minimalistic virtual machine used to execute mruby bytecode, nicknamed ritevm:

$ mrbc test.rb $ mruby -b test.mrb

The first command compiles Ruby code to mruby bytecode, creating a file called "test.mrb", which can then be executed by appending the "-b" flag to the normal interpreter arguments.

References

Mruby Wikipedia


Similar Topics
Meet Your Meat
Simon Colton
DC Curtis
Topics
 
B
i
Link
H2
L