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"
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"

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
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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

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

View File

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