2015-07-14 15:03:06 +02:00
|
|
|
|
2015-07-14 13:08:28 +02:00
|
|
|
require 'browser'
|
2015-07-08 01:10:34 +02:00
|
|
|
require 'native'
|
2015-07-09 21:43:07 +02:00
|
|
|
require "salama"
|
2015-08-20 00:53:20 +02:00
|
|
|
require "interpreter/interpreter"
|
2015-08-21 20:05:49 +02:00
|
|
|
require "base/list_view"
|
2015-08-20 00:53:20 +02:00
|
|
|
require_relative "class_view"
|
2015-08-20 20:03:00 +02:00
|
|
|
require_relative "status_view"
|
2015-08-21 00:37:41 +02:00
|
|
|
require_relative "file_view"
|
|
|
|
require_relative "blocks_view"
|
2015-08-21 19:07:27 +02:00
|
|
|
require_relative "registers_view"
|
2015-07-13 22:11:00 +02:00
|
|
|
|
2015-08-20 14:48:45 +02:00
|
|
|
class MainView < ListView
|
2015-07-09 11:32:29 +02:00
|
|
|
|
2015-07-06 20:55:34 +02:00
|
|
|
def initialize
|
2015-08-20 00:53:20 +02:00
|
|
|
machine = Virtual.machine.boot
|
2015-08-20 16:13:57 +02:00
|
|
|
|
|
|
|
# compile_main includes the parse
|
|
|
|
# parsing generates an ast as seen below and then compiles it.
|
2015-08-20 19:40:47 +02:00
|
|
|
# machine.compile_main "2 + 5"
|
2015-08-20 16:13:57 +02:00
|
|
|
|
|
|
|
# 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-08-20 19:40:47 +02:00
|
|
|
code = Ast::OperatorExpression.new("+", Ast::IntegerExpression.new(2),Ast::IntegerExpression.new(5))
|
|
|
|
Virtual::Compiler.compile( code , machine.space.get_main )
|
2015-08-20 16:13:57 +02:00
|
|
|
|
2015-08-20 00:53:20 +02:00
|
|
|
machine.run_before "Register::CallImplementation"
|
|
|
|
@interpreter = Interpreter::Interpreter.new
|
2015-08-21 19:07:27 +02:00
|
|
|
super( [ClassView.new(@interpreter) ,
|
|
|
|
FileView.new ,
|
|
|
|
BlocksView.new(@interpreter) ,
|
|
|
|
StatusView.new(@interpreter) ,
|
|
|
|
RegistersView.new(@interpreter) ] )
|
2015-07-06 20:55:34 +02:00
|
|
|
end
|
2015-07-09 14:23:36 +02:00
|
|
|
|
2015-07-06 20:55:34 +02:00
|
|
|
end
|