first oo steps are wobbly, but a string.plus parses

This commit is contained in:
Torsten Ruger
2014-06-01 14:24:54 +03:00
parent 86431120d5
commit 9ea0acf2e3
5 changed files with 48 additions and 9 deletions

View File

@ -42,8 +42,6 @@ module Ast
end
end
class VariableExpression < NameExpression
end
class ModuleName < NameExpression
end

View File

@ -35,4 +35,11 @@ module Ast
end
end
class VariableExpression < CallSiteExpression
def initialize name
super( :_get_instance_variable , [StringExpression.new(name)] )
end
end
end

View File

@ -16,10 +16,9 @@ module Ast
end
def compile context , into
clazz = context.object_space.get_or_create_class name
puts "Class #{clazz.inspect}"
context.class = clazz
context.current_class = clazz
expressions.each do |expression|
# check if it'sa function definition and add
# check if it's a function definition and add
# if not, execute it, but that does means we should be in crystal (executable), not ruby. ie throw an error for now
raise "only functions for now #{expression.inspect}" unless expression.is_a? Ast::FunctionExpression
expression_value = expression.compile(context , nil )