diff --git a/app/debugger.rb b/app/debugger.rb index fac439d..3b68e0e 100644 --- a/app/debugger.rb +++ b/app/debugger.rb @@ -2,18 +2,8 @@ class Debugger include React::Component -# required_param :machine - define_state :machine => Virtual.machine.boot - - before_mount do - code = Ast::ExpressionList.new [Ast::CallSiteExpression.new( "putstring", [], Ast::StringExpression.new("Hello again"))] - Virtual::Compiler.compile( code , machine.space.get_main ) - machine.run_before "Register::CallImplementation" - end - - def initialize - @interpreter = Interpreter.new - end + required_param :machine , :type => Virtual::Machine + define_state :interpreter => Interpreter.new def render div.container do @@ -33,7 +23,7 @@ class Debugger BlockView block: [ "block 1" , "block 2"] end end - RegisterView registers: @interpreter.registers + RegisterView registers: interpreter.registers end end end diff --git a/app/main.rb b/app/main.rb index 194698f..b89b3da 100644 --- a/app/main.rb +++ b/app/main.rb @@ -1,17 +1,24 @@ require 'opal' require "opal/parser" -require 'opal-jquery' -require "json" -require 'opal-react' require "salama" +require "interpreter" + +require 'opal-react' + require "class_view" require "register_view" require "source_view" require "block_view" -require "interpreter" require "debugger" +require 'opal-jquery' + Document.ready? do # Document.ready? is a opal-jquery method. - React.render( React.create_element( Debugger ), Element['#content'] ) + machine = Virtual.machine.boot + React.render( React.create_element( Debugger , :machine => machine ), Element['#content'] ) + code = Ast::ExpressionList.new( [Ast::CallSiteExpression.new(:putstring, [] ,Ast::StringExpression.new("Hello again"))]) + Virtual::Compiler.compile( code , machine.space.get_main ) + machine.run_before "Register::CallImplementation" + end diff --git a/config.ru b/config.ru index d5b13a3..a20d43e 100644 --- a/config.ru +++ b/config.ru @@ -1,7 +1,6 @@ # config.ru require 'bundler' Bundler.require -require "opal/parser" Opal.use_gem "salama" Opal.use_gem "salama-arm"