rubyx/lib/compiler.rb

21 lines
734 B
Ruby
Raw Normal View History

module Compiler
def self.compile expression , method , message
exp_name = expression.class.name.split("::").last.sub("Expression","").downcase
puts "Expression #{exp_name}"
self.send "compile_#{exp_name}".to_sym , expression, method , message
end
end
require_relative "compiler/basic_expressions"
require_relative "compiler/call_site_expression"
require_relative "compiler/compound_expressions"
require_relative "compiler/if_expression"
require_relative "compiler/function_expression"
require_relative "compiler/module_expression"
require_relative "compiler/operator_expressions"
require_relative "compiler/return_expression"
require_relative "compiler/while_expression"
require_relative "compiler/expression_list"