2017-04-08 11:11:52 +02:00
|
|
|
require_relative "ruby_compiler"
|
|
|
|
|
|
|
|
module Vool
|
|
|
|
class VoolCompiler
|
2017-08-30 16:21:13 +02:00
|
|
|
|
2018-03-12 12:53:16 +01:00
|
|
|
def self.ruby_to_vool( ruby_source )
|
2018-06-29 13:57:48 +02:00
|
|
|
vool = RubyCompiler.compile( ruby_source )
|
|
|
|
vool = vool.normalize
|
|
|
|
vool
|
2017-04-08 11:11:52 +02:00
|
|
|
end
|
2018-06-29 10:36:14 +02:00
|
|
|
|
2018-05-16 20:00:14 +02:00
|
|
|
def self.ruby_to_binary(source , platform = :arm)
|
2018-03-29 19:37:25 +02:00
|
|
|
machine = Risc.machine.boot
|
2018-06-29 13:57:48 +02:00
|
|
|
vool = self.ruby_to_vool(source)
|
|
|
|
vool.to_mom(nil)
|
2018-05-16 20:00:14 +02:00
|
|
|
machine.translate(platform)
|
2018-03-29 19:37:25 +02:00
|
|
|
machine.position_all
|
2018-05-01 18:19:04 +02:00
|
|
|
machine.create_binary
|
2018-03-29 19:37:25 +02:00
|
|
|
end
|
2017-04-08 11:11:52 +02:00
|
|
|
end
|
|
|
|
end
|