diff --git a/Gemfile b/Gemfile index 2d52af7a..08b13919 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "http://rubygems.org" -gem "parslet" , :git => 'https://github.com/NigelThorne/parslet.git' -gem "salama-reader" , "0.1.0" , :require => "parser" , :git => "https://github.com/salama/salama-reader.git" +gem "parslet" +gem "salama-reader" , "0.0.2" , :require => "parser" , :git => "https://github.com/salama/salama-reader.git" group :development do gem "minitest" diff --git a/Gemfile.lock b/Gemfile.lock index 107b2137..7606906c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,15 +1,9 @@ -GIT - remote: https://github.com/NigelThorne/parslet.git - revision: be698466bfa21a35d838fc7d3cd741b8aa1977b0 - specs: - parslet (1.7.0) - blankslate (~> 2.0) - GIT remote: https://github.com/salama/salama-reader.git - revision: 5e56cf592247440561068047bcc490ad3e4afd21 + revision: 484990b093f0b01b61028902aa5fcafee7a7c9b6 specs: - salama-reader (0.1.0) + salama-reader (0.0.2) + salama (~> 0.0.1) GEM remote: http://rubygems.org/ @@ -61,6 +55,8 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (~> 1.2) + parslet (1.6.1) + blankslate (~> 2.0) pry (0.9.12.6) coderay (~> 1.0) method_source (~> 0.8) @@ -73,6 +69,8 @@ GEM ruby_parser (~> 3.2, >= 3.2.2) ruby_parser (3.6.1) sexp_processor (~> 4.1) + salama (0.0.1) + parslet (~> 1.6.1) sexp_processor (4.4.3) simplecov (0.8.2) docile (~> 1.1.0) @@ -89,8 +87,8 @@ PLATFORMS DEPENDENCIES jeweler minitest - parslet! + parslet pry roodi - salama-reader (= 0.1.0)! + salama-reader (= 0.0.2)! simplecov diff --git a/lib/ast/function_expression.rb b/lib/ast/function_expression.rb index 8c5d9348..10ebbbb8 100644 --- a/lib/ast/function_expression.rb +++ b/lib/ast/function_expression.rb @@ -3,7 +3,7 @@ module Ast # attr_reader :name, :params, :body , :receiver def compile method , message args = params.collect do |p| - raise "error, arguemnt must be a identifier, not #{p}" unless p.is_a? NameExpression + raise "error, argument must be a identifier, not #{p}" unless p.is_a? NameExpression p.name end r = receiver ? receiver.compile(method,message) : Virtual::Self.new() diff --git a/lib/trickle/send.rb b/lib/trickle/send.rb index 3cae71e5..0b1bac84 100644 --- a/lib/trickle/send.rb +++ b/lib/trickle/send.rb @@ -6,9 +6,20 @@ module Trickle def run block block.codes.dup.each do |code| next unless code.is_a? Virtual::MessageSend - puts "Found me a send #{code.me.type}" - if( code.me.type == Virtual::Reference) - next + me = code.me + next unless ( me.type == Virtual::Reference) + if( me.is_a? Virtual::Constant) + Boot::BootClass + if( me.is_a? Boot::BootClass ) + raise "unimplemented" + elsif( me.is_a? Virtual::ObjectConstant ) + clazz = me.clazz + method = clazz.get_method_definition code.name + puts "Found me a method #{method}" + raise "Method not implemented #{clazz.name}.#{code.name}" unless method + else + raise "unimplemented" + end end end end diff --git a/lib/virtual/constants.rb b/lib/virtual/constants.rb index 8b5df53e..6b91bc01 100644 --- a/lib/virtual/constants.rb +++ b/lib/virtual/constants.rb @@ -15,6 +15,9 @@ module Virtual def type Virtual::Reference end + def claszz + raise "abstract #{self}" + end end class IntegerConstant < Constant @@ -40,6 +43,9 @@ module Virtual def result= value class_for(MoveInstruction).new(value , self , :opcode => :mov) end + def clazz + Object.space.get_or_create_class(:String) + end end end \ No newline at end of file diff --git a/lib/virtual/object.rb b/lib/virtual/object.rb index f0bb7764..f708ac53 100644 --- a/lib/virtual/object.rb +++ b/lib/virtual/object.rb @@ -25,7 +25,7 @@ module Virtual end def inspect - to_yaml + Sof::Writer.write(self) end def self.space diff --git a/test/virtual/hello.rb b/test/virtual/hello.rb index f41e21a9..b856a98a 100644 --- a/test/virtual/hello.rb +++ b/test/virtual/hello.rb @@ -22,12 +22,21 @@ HERE check end - def test_puts_string + def ttest_puts_string @string_input = <