remove the parse code and fix the rest to work with the gem (from git for now)

This commit is contained in:
Torsten Ruger
2014-06-04 22:03:45 +03:00
parent e9d2724f62
commit 7cc4c6344c
45 changed files with 33 additions and 1708 deletions

View File

@ -2,13 +2,7 @@ module Ast
# assignment, like operators are really function calls
class CallSiteExpression < Expression
attr_reader :name, :args , :receiver
def initialize name, args , receiver = Ast::NameExpression.new(:self)
@name = name.to_sym
@args = args
@receiver = receiver
end
# attr_reader :name, :args , :receiver
def compile context , into
params = args.collect{ |a| a.compile(context, into) }
@ -37,28 +31,10 @@ module Ast
puts "compile call #{function.return_type}"
function.return_type
end
def inspect
self.class.name + ".new(" + name.inspect + ", ["+
args.collect{|m| m.inspect }.join( ",") + "] ," + receiver.inspect + ")"
end
def to_s
"#{name}(" + args.join(",") + ")"
end
def attributes
[:name , :args , :receiver]
end
end
class VariableExpression < CallSiteExpression
def initialize name
super( :_get_instance_variable , [StringExpression.new(name)] )
end
def inspect
self.class.name + ".new(" + args[0].string.inspect + ")"
end
# super( :_get_instance_variable , [StringExpression.new(name)] )
end
end