with the to_basic it actually compiles in the browser

also outputs the space using sof, just like in terminal
opal really is a feat of engineering
This commit is contained in:
Torsten Ruger 2015-07-12 10:03:23 +03:00
parent 1ebdf7f43c
commit 157981edf0
2 changed files with 9 additions and 2 deletions

View File

@ -5,6 +5,8 @@ if RUBY_PLATFORM == 'opal'
require "main/lib/main_view"
end
Virtual::Machine.boot
module Main
class MainController < Volt::ModelController
@ -13,11 +15,16 @@ module Main
end
def about
promise = ParseTask.parse(1).then do |result|
ParseTask.parse(1).then do |result|
puts result
is = Ast::Expression.from_basic(result)
puts "back #{is.class}"
Virtual::Compiler.compile( is , Virtual.machine.space.get_main )
puts Virtual.machine.space.objects
end.fail do |error|
puts "Error: #{error}"
end
end
private

View File

@ -6,6 +6,6 @@ class ParseTask < Volt::Task
parser = Parser::Salama.new
out = parser.parse(string_input)
parts = Parser::Transform.new.apply(out)
Sof.write parts
parts.to_basic
end
end