fbpx
Wikipedia

mruby

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

mruby
Developer(s)Yukihiro Matsumoto et al.
Initial releaseApril 20, 2012; 12 years ago (2012-04-20)
Stable release
3.3.0[1][2]  / 14 February 2024; 2 months ago (14 February 2024)
Repository
  • github.com/mruby/mruby
Written inC and Ruby
Operating systemCross-platform
Standard(s)ISO/IEC 30170:2012
TypeRuby programming language interpreter
LicenseMIT License[3]
Websitemruby.org

Features edit

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 2.0.0[6] adds support for several Ruby 2.x methods beyond Ruby 2.1. v2.0.0 also changed to variable length bytecode instructions format.

mruby bytecode can be embedded in C code, and thus, can be compiled into a standalone executable.[7]

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

Examples edit

Calling mruby from C edit

#include <stdio.h> #include <mruby.h> #include <mruby/compile.h> int main(void) {  mrb_state *mrb = mrb_open();  char code[] = "5.times { puts 'mruby is awesome!' }";  printf("Executing Ruby code with mruby:\n");  mrb_load_string(mrb, code);  mrb_close(mrb);  return 0; } 

Assuming that the mruby library and headers are installed, the program can be compiled and executed by running the following commands from the terminal:[9]

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

Precompiled Bytecode edit

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.[10]

References edit

  1. ^ "Release 3.3.0".
  2. ^ "mruby 3.3.0 released".
  3. ^ "LICENSE". Github. Retrieved 6 September 2019.
  4. ^ a b "mruby/mruby". GitHub. Retrieved 2018-04-30.
  5. ^ mruby and MobiRuby announced
  6. ^ "mruby 2.0.0 released". mruby.org. Retrieved 2019-04-01.
  7. ^ "Executing Ruby code with mruby". mruby.org. Retrieved 2019-04-01.
  8. ^ "ISO/IEC 30170:2012". ISO. Retrieved 2019-04-01.
  9. ^ Aimonetti, Matt (2012-04-25). "Getting started with mruby". Retrieved 2013-12-29.
  10. ^ geekmonkey (2012-10-30). "An introduction to Mini Ruby". Retrieved 2013-12-29.

mruby, interpreter, ruby, programming, language, with, intention, being, lightweight, easily, embeddable, project, headed, yukihiro, matsumoto, with, over, contributors, currently, working, project, developer, yukihiro, matsumoto, initial, releaseapril, 2012, . mruby is an interpreter for the Ruby programming language with the intention of being lightweight and easily embeddable 4 5 The project is headed by Yukihiro Matsumoto with over 100 contributors currently working on the project mrubyDeveloper s Yukihiro Matsumoto et al Initial releaseApril 20 2012 12 years ago 2012 04 20 Stable release3 3 0 1 2 14 February 2024 2 months ago 14 February 2024 Repositorygithub wbr com wbr mruby wbr mrubyWritten inC and RubyOperating systemCross platformStandard s ISO IEC 30170 2012TypeRuby programming language interpreterLicenseMIT License 3 Websitemruby wbr org Contents 1 Features 2 Examples 2 1 Calling mruby from C 2 2 Precompiled Bytecode 3 ReferencesFeatures editmruby 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 2 0 0 6 adds support for several Ruby 2 x methods beyond Ruby 2 1 v2 0 0 also changed to variable length bytecode instructions format mruby bytecode can be embedded in C code and thus can be compiled into a standalone executable 7 mruby also aims 4 to be compliant with the ISO IEC 30170 2012 standard 8 Examples editCalling mruby from C edit include lt stdio h gt include lt mruby h gt include lt mruby compile h gt int main void mrb state mrb mrb open char code 5 times puts mruby is awesome printf Executing Ruby code with mruby n mrb load string mrb code mrb close mrb return 0 Assuming that the mruby library and headers are installed the program can be compiled and executed by running the following commands from the terminal 9 cc example c lmruby lm o example example Precompiled Bytecode edit 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 10 References edit Release 3 3 0 mruby 3 3 0 released LICENSE Github Retrieved 6 September 2019 a b mruby mruby GitHub Retrieved 2018 04 30 mruby and MobiRuby announced mruby 2 0 0 released mruby org Retrieved 2019 04 01 Executing Ruby code with mruby mruby org Retrieved 2019 04 01 ISO IEC 30170 2012 ISO Retrieved 2019 04 01 Aimonetti Matt 2012 04 25 Getting started with mruby Retrieved 2013 12 29 geekmonkey 2012 10 30 An introduction to Mini Ruby Retrieved 2013 12 29 Retrieved from https en wikipedia org w index php title Mruby amp oldid 1208464904, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.