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'
|
2015-10-21 13:03:56 +02:00
|
|
|
require 'browser/http'
|
2015-08-24 01:49:41 +02:00
|
|
|
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-21 13:03:56 +02:00
|
|
|
require "views/switch_view"
|
2015-10-19 18:56:35 +02:00
|
|
|
require "views/status_view"
|
2015-10-29 15:49:14 +01:00
|
|
|
require "views/source_view"
|
2015-10-19 18:56:35 +02:00
|
|
|
require "views/instruction_view"
|
|
|
|
require "views/registers_view"
|
2015-08-24 01:49:41 +02:00
|
|
|
|
|
|
|
class MainView < ListView
|
2015-10-27 11:44:02 +01:00
|
|
|
include AST::Sexp
|
2015-08-24 01:49:41 +02:00
|
|
|
|
|
|
|
def initialize
|
2015-10-27 11:44:02 +01:00
|
|
|
machine = Register.machine.boot
|
2015-10-31 23:06:03 +01:00
|
|
|
code = s(:statements, s(:class, :Object, s(:derives, nil),
|
2015-10-21 13:03:56 +02:00
|
|
|
s(:statements, s(:class_field, :Integer, :x))))
|
2015-10-29 15:49:14 +01:00
|
|
|
Soml.compile( code )
|
2015-10-19 18:56:35 +02:00
|
|
|
machine.collect
|
2015-08-24 01:49:41 +02:00
|
|
|
@interpreter = Interpreter::Interpreter.new
|
2015-10-21 13:03:56 +02:00
|
|
|
super( [SwitchView.new(@interpreter) ,
|
2015-10-29 15:49:14 +01:00
|
|
|
SourceView.new(@interpreter) ,
|
2015-08-24 01:49:41 +02:00
|
|
|
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)
|