2015-07-14 13:08:28 +02:00
|
|
|
|
|
|
|
require "opal"
|
2015-07-14 15:03:06 +02:00
|
|
|
require "opal-parser"
|
2015-08-24 01:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
require 'browser'
|
|
|
|
require 'native'
|
|
|
|
require "salama"
|
2015-10-02 19:25:54 +02:00
|
|
|
require "salama-reader"
|
|
|
|
require "ast"
|
2015-08-24 01:49:41 +02:00
|
|
|
require "interpreter/interpreter"
|
2015-10-07 11:24:02 +02:00
|
|
|
# the base, our own litle framework, allows for child and parent views and handles updates
|
2015-08-24 01:49:41 +02:00
|
|
|
require "base/list_view"
|
2015-10-07 11:24:02 +02:00
|
|
|
# each seperate view is in it's own class.
|
2015-10-19 18:56:35 +02:00
|
|
|
require "views/classes_view"
|
|
|
|
require "views/status_view"
|
|
|
|
require "views/file_view"
|
|
|
|
require "views/blocks_view"
|
|
|
|
require "views/instruction_view"
|
|
|
|
require "views/registers_view"
|
|
|
|
require "code"
|
2015-08-24 01:49:41 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2015-10-17 09:10:33 +02:00
|
|
|
Phisol::Compiler.compile( CODE )
|
2015-08-24 01:49:41 +02:00
|
|
|
|
2015-10-19 18:56:35 +02:00
|
|
|
machine.collect
|
2015-08-24 01:49:41 +02:00
|
|
|
@interpreter = Interpreter::Interpreter.new
|
|
|
|
@interpreter.start machine.init
|
|
|
|
super( [ClassesView.new(@interpreter) ,
|
|
|
|
FileView.new ,
|
|
|
|
BlocksView.new(@interpreter) ,
|
|
|
|
InstructionView.new(@interpreter) ,
|
|
|
|
StatusView.new(@interpreter) ,
|
|
|
|
RegistersView.new(@interpreter) ] )
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2015-07-14 13:08:28 +02:00
|
|
|
|
2015-08-20 19:40:47 +02:00
|
|
|
view = MainView.new()
|
|
|
|
view.draw.append_to($document.body)
|