mruby is a lightweight implementation of the Ruby language designed to be linked and embedded into other applications. It is a branch of the original project initiated by the same author Yukihiro Matsumoto (a.k.a. Matz) and a strong international team of contributors. There are several reasons to be enthusiastic about this development even for us embedded control developers (spoiler alert, see #4 and #5):
- It introduces the possibility to create single file executables for Ruby applications. This can reduce considerably the (deployment/distribution) headaches due to library dependencies common to traditional Ruby (but also Python, Java …) projects. All the necessary modules for an application can be compiled (to byte codes) and shipped without the need to include source files and without having to handle large folder trees comprising several tens (or hundreds) of individual files.
- The ability to produce byte codes (files) is also new to Ruby, although it had been used extensively in other languages (Java, Python…) before.
- Taking a lesson from LUA (eLua project), mruby can now be easily launched from inside a C/C++ application. A script can be passed as a text file to the compiler/interpreter or as a byte code (array) directly to the interpreter. The latter is the mechanism that allows a single file executable model as per #1.
- Most importantly for us embedded control developers, mruby has gone on a strong diet. Many of the builtin (system) services and features have now been re-factored outside the mruby core and can be re-introduced (if needed) by accessing individual library modules.
- As a consequence, the interpreter is now much reduced in size and can be cross compiled for low cost 32-bit microcontrollers including …. the PIC32 (MX7)! The official repository on GitHub contains already examples for a few embedded platforms including the chipKIT MAX32!