getting to where where the puts should be, but it aint there

This commit is contained in:
Torsten Ruger 2014-08-22 10:21:12 +03:00
parent b305a56576
commit e19b7be111
7 changed files with 43 additions and 19 deletions

View File

@ -1,7 +1,7 @@
source "http://rubygems.org" source "http://rubygems.org"
gem "parslet" , :git => 'https://github.com/NigelThorne/parslet.git' gem "parslet"
gem "salama-reader" , "0.1.0" , :require => "parser" , :git => "https://github.com/salama/salama-reader.git" gem "salama-reader" , "0.0.2" , :require => "parser" , :git => "https://github.com/salama/salama-reader.git"
group :development do group :development do
gem "minitest" gem "minitest"

View File

@ -1,15 +1,9 @@
GIT
remote: https://github.com/NigelThorne/parslet.git
revision: be698466bfa21a35d838fc7d3cd741b8aa1977b0
specs:
parslet (1.7.0)
blankslate (~> 2.0)
GIT GIT
remote: https://github.com/salama/salama-reader.git remote: https://github.com/salama/salama-reader.git
revision: 5e56cf592247440561068047bcc490ad3e4afd21 revision: 484990b093f0b01b61028902aa5fcafee7a7c9b6
specs: specs:
salama-reader (0.1.0) salama-reader (0.0.2)
salama (~> 0.0.1)
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
@ -61,6 +55,8 @@ GEM
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (~> 1.2) rack (~> 1.2)
parslet (1.6.1)
blankslate (~> 2.0)
pry (0.9.12.6) pry (0.9.12.6)
coderay (~> 1.0) coderay (~> 1.0)
method_source (~> 0.8) method_source (~> 0.8)
@ -73,6 +69,8 @@ GEM
ruby_parser (~> 3.2, >= 3.2.2) ruby_parser (~> 3.2, >= 3.2.2)
ruby_parser (3.6.1) ruby_parser (3.6.1)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
salama (0.0.1)
parslet (~> 1.6.1)
sexp_processor (4.4.3) sexp_processor (4.4.3)
simplecov (0.8.2) simplecov (0.8.2)
docile (~> 1.1.0) docile (~> 1.1.0)
@ -89,8 +87,8 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
jeweler jeweler
minitest minitest
parslet! parslet
pry pry
roodi roodi
salama-reader (= 0.1.0)! salama-reader (= 0.0.2)!
simplecov simplecov

View File

@ -3,7 +3,7 @@ module Ast
# attr_reader :name, :params, :body , :receiver # attr_reader :name, :params, :body , :receiver
def compile method , message def compile method , message
args = params.collect do |p| 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 p.name
end end
r = receiver ? receiver.compile(method,message) : Virtual::Self.new() r = receiver ? receiver.compile(method,message) : Virtual::Self.new()

View File

@ -6,9 +6,20 @@ module Trickle
def run block def run block
block.codes.dup.each do |code| block.codes.dup.each do |code|
next unless code.is_a? Virtual::MessageSend next unless code.is_a? Virtual::MessageSend
puts "Found me a send #{code.me.type}" me = code.me
if( code.me.type == Virtual::Reference) next unless ( me.type == Virtual::Reference)
next 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 end
end end

View File

@ -15,6 +15,9 @@ module Virtual
def type def type
Virtual::Reference Virtual::Reference
end end
def claszz
raise "abstract #{self}"
end
end end
class IntegerConstant < Constant class IntegerConstant < Constant
@ -40,6 +43,9 @@ module Virtual
def result= value def result= value
class_for(MoveInstruction).new(value , self , :opcode => :mov) class_for(MoveInstruction).new(value , self , :opcode => :mov)
end end
def clazz
Object.space.get_or_create_class(:String)
end
end end
end end

View File

@ -25,7 +25,7 @@ module Virtual
end end
def inspect def inspect
to_yaml Sof::Writer.write(self)
end end
def self.space def self.space

View File

@ -22,12 +22,21 @@ HERE
check check
end end
def test_puts_string def ttest_puts_string
@string_input = <<HERE @string_input = <<HERE
def foo() def foo()
puts("Hello") puts("Hello")
end end
foo() foo()
HERE
check
end
def test_string_put
@string_input = <<HERE
def foo()
"Hello".puts()
end
HERE HERE
check check
end end