Class: RVM::Languages::Math

Inherits:
Language show all
Defined in:
lib/rvm/languages/math.rb,
lib/rvm/languages/math/tree.rb,
lib/rvm/languages/math/compiler.rb,
lib/rvm/languages/math/tokenizer.rb

Overview

This compiler handels mathematical expressions.

It is limited to smiple terms, as in for example integration of functions is not offered. Yet it is hopefully enough to serve most mathematical needs.

Included are:

* Opperators: +, -, *, /, ^
* Parenthetes
* Functions (as in proveded by the 'rvm/funcions/math' library or custom loaded)
* Currect prioriets in execution
* Support for variables (getting and setting)
* Multiple concatinated statemetns sepperated by ';'
* Custom functions (as in defining as well as calling)

Defined Under Namespace

Classes: Compiler, Tokenizer, Tree

Instance Method Summary collapse

Methods inherited from Language

#core_libs, #env, #initialize

Methods included from Plugin

#helper, #included, #plugin_host, #plugin_id, #register_for

Constructor Details

This class inherits a constructor from RVM::Languages::Language

Instance Method Details

#compile(text) ⇒ Object



21
22
23
# File 'lib/rvm/languages/math.rb', line 21

def compile text
  Compiler.compile(Tree.generate(Tokenizer.tokenize(text)))
end