don't pre-start interpreter anymore, but allow for switching source

This commit is contained in:
Torsten Ruger 2015-10-21 14:03:56 +03:00
parent 4752732bf8
commit b8e309b701

View File

@ -4,6 +4,7 @@ require "opal-parser"
require 'browser'
require 'browser/http'
require 'native'
require "salama"
require "salama-reader"
@ -12,7 +13,7 @@ require "interpreter/interpreter"
# the base, our own litle framework, allows for child and parent views and handles updates
require "base/list_view"
# each seperate view is in it's own class.
require "views/classes_view"
require "views/switch_view"
require "views/status_view"
require "views/file_view"
require "views/blocks_view"
@ -24,20 +25,12 @@ class MainView < ListView
def initialize
machine = Virtual.machine.boot
# compile_main includes the parse
# parsing generates an ast as seen below and then compiles it.
# machine.compile_main "2 + 5"
# so the code above is functionally equivalent to the one below, minus the parse
# When the ast expression is given all works, so pretty sure it is the parse that fails
Phisol::Compiler.compile( CODE )
code = s(:statements, s(:class, :Foo, s(:derives, nil),
s(:statements, s(:class_field, :Integer, :x))))
Phisol::Compiler.compile( code )
machine.collect
@interpreter = Interpreter::Interpreter.new
@interpreter.start machine.init
super( [ClassesView.new(@interpreter) ,
super( [SwitchView.new(@interpreter) ,
FileView.new ,
BlocksView.new(@interpreter) ,
InstructionView.new(@interpreter) ,