2017-04-08 12:11:52 +03:00
|
|
|
require_relative "ruby_compiler"
|
|
|
|
|
|
|
|
module Vool
|
|
|
|
class VoolCompiler
|
2017-08-30 17:21:13 +03:00
|
|
|
|
2018-03-12 17:23:16 +05:30
|
|
|
def self.ruby_to_vool( ruby_source )
|
2017-04-08 12:11:52 +03:00
|
|
|
statements = RubyCompiler.compile( ruby_source )
|
2018-03-15 12:46:56 +05:30
|
|
|
statements = statements.normalize
|
2018-03-15 17:22:56 +05:30
|
|
|
statements.create_objects
|
2017-04-08 12:11:52 +03:00
|
|
|
statements
|
|
|
|
end
|
2018-03-12 18:13:26 +05:30
|
|
|
def self.ruby_to_mom(source)
|
2018-03-13 12:30:51 +05:30
|
|
|
statements = self.ruby_to_vool(source)
|
|
|
|
statements.to_mom(nil)
|
2018-03-12 18:13:26 +05:30
|
|
|
end
|
2018-05-16 21:00:14 +03:00
|
|
|
def self.ruby_to_binary(source , platform = :arm)
|
2018-03-29 20:37:25 +03:00
|
|
|
machine = Risc.machine.boot
|
|
|
|
self.ruby_to_vool(source)
|
2018-05-16 21:00:14 +03:00
|
|
|
machine.translate(platform)
|
2018-03-29 20:37:25 +03:00
|
|
|
machine.position_all
|
2018-05-01 19:19:04 +03:00
|
|
|
machine.create_binary
|
2018-03-29 20:37:25 +03:00
|
|
|
end
|
2017-04-08 12:11:52 +03:00
|
|
|
end
|
|
|
|
end
|