Mruby
From Wikipedia, the free encyclopedia
|
Mrubyのロゴマーク。 | |||
| 作者 | まつもとゆきひろ | ||
|---|---|---|---|
| 開発元 | まつもとゆきひろ | ||
| 初版 | 2012年4月20日 | ||
| 最新評価版 |
| ||
| リポジトリ | |||
| プログラミング 言語 | C言語、Ruby | ||
| 対応OS | クロスプラットフォーム | ||
| プラットフォーム | 組み込みシステム | ||
| 前身 | 無し | ||
| 対応言語 | 日本語・英語? | ||
| サポート状況 | サポート中 | ||
| 種別 | Rubyインタプリタ・IoT・オープンソース | ||
| ライセンス | MITライセンス | ||
| 公式サイト |
mruby | ||
mruby (エムルビー) は、組み込みシステム向けの軽量なRuby言語処理系である[2]。このプロジェクトはRubyの開発者であるまつもとゆきひろがリーダーを務めており、100人以上がこのプロジェクトに貢献している。
例
- C言語からmrubyを呼び出す場合
#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;
}
- 以下のコマンドでコンパイルと実行ができる[3]。
$ cc example.c -lmruby -lm -o example $ ./example
- プリコンパイルされたバイトコード
- mrubyにはmrubyバイトコードを実行するための最小限の仮想マシンが組み込まれている。
$ mrbc test.rb $ mruby -b test.mrb
