= partialruby - Ruby partial interpreter written in pure ruby What I trying to say with "partial" ? Well, the ruby interpreter is composed by a few main conceptual "components": parser, api, VM and execution environment. A partial interpreter will be a library implementing only one or even only part of one of these basic components. In this case, partialruby only implements part of the VM (e.g. partialruby DOESN'T implement a GC), use the excenllent ruby_parser gem (https://github.com/seattlerb/ruby_parser) to parse ruby code and use the real interpreter to the rest (api, environment, etc...). == Goals: === Implement a alternative VM which export services that is not exported by the original VM without implementing a entire ruby interpreter or fork an existing ruby interpreter - Control of execution flow via hooking for sandboxing (see evalhook and shikashi projects) - Fast DSL (over ruby, and faster than ruby itself!) === Proof of Concept of interpreter and partial interpreter development - Hyper-portability: microruby - Search for a faster ruby == Installation === Gem Installation (pending) sudo gem install partialruby OR * Download the last version of the gem from http://github.com/tario/partialruby/downloads * Install the gem with the following; sudo gem install partialruby-X.X.X.gem. == Documentation (pending) Full API documentation can be found on: http://tario.github.com/partialruby/doc/ == Usage (pending) Basically, partialruby export two APIs: * A alernative eval function with context. Example: require "partialruby" context = PartialRuby::Context.new context.eval('print "hello world\n"') Or require "partialruby" PartialRuby.eval('print "hello world\n"') * A flexible node handling. Example require "partialruby" class MyPartialRubyContext < PartialRuby::Context def ruby_emul_call(tree) object_tree = tree[1] method_name = tree[2] arglist = tree[3] argsstr = arglist[1..-1]. map{|subtree| "(" + emul(subtree, frame) + ")" }. join(",") if (object_tree) "((#{emul(object_tree)}).#{method_name}(#{argsstr})" else if arglist.count == 0 "#{method_name}(#{argsstr})" else "#{method_name}" end end end end context = MyPartialRubyContext.new context.eval('print "hello world\n"') == Copying Copyright (c) 2010-2011 Dario Seminara, released under the GPL License (see LICENSE)
Project
partialruby
Ruby partial interpreter written in pure-ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Dependencies
Runtime
~> 2
~> 3
Project Readme