rename compilers to passses

This commit is contained in:
Torsten Ruger 2017-01-16 17:24:32 +02:00
parent 8dbbffd58e
commit 4ba182a822
14 changed files with 22 additions and 22 deletions

View File

@ -1,5 +1,5 @@
module Melon
module Compilers
module Passes
class LocalsCollector < TotalProcessor
def initialize

View File

@ -1,5 +1,5 @@
module Melon
module Compilers
module Passes
class MethodCollector < TotalProcessor

View File

@ -1,5 +1,5 @@
module Melon
module Compilers
module Passes
class MethodCompiler < AST::Processor

View File

@ -1,5 +1,5 @@
module Melon
module Compilers
module Passes
class Normalizer < AST::Processor

View File

@ -1,6 +1,6 @@
module Melon
module Compilers
module Passes
class TotalProcessor < AST::Processor
def handler_missing(node)

View File

@ -1,5 +1,5 @@
module Melon
module Compilers
module Passes
class TypeCollector < TotalProcessor
def initialize

View File

@ -1,16 +1,16 @@
require "parser/ruby22"
require_relative "compilers/total_processor"
require_relative "compilers/type_collector"
require_relative "compilers/method_collector"
require_relative "compilers/method_compiler"
require_relative "compilers/locals_collector"
require_relative "compilers/normalizer"
require_relative "passes/total_processor"
require_relative "passes/type_collector"
require_relative "passes/method_collector"
require_relative "passes/method_compiler"
require_relative "passes/locals_collector"
require_relative "passes/normalizer"
require_relative "ruby_method"
module Melon
class RubyCompiler < Compilers::TotalProcessor
class RubyCompiler < Passes::TotalProcessor
def self.compile( input )
ast = Parser::Ruby22.parse( input )
@ -21,17 +21,17 @@ module Melon
name , sup , body = *statement
class_name = get_name(name)
clazz = Parfait.object_space.get_class_by_name!(class_name , get_name(sup) )
ivar_hash = Compilers::TypeCollector.new.collect(body)
ivar_hash = Passes::TypeCollector.new.collect(body)
clazz.set_instance_type( Parfait::Type.for_hash( clazz , ivar_hash ) )
methods = create_methods(clazz , body)
compile_methods(clazz,methods)
end
def create_methods(clazz , body)
methods = Compilers::MethodCollector.new.collect(body)
methods = Passes::MethodCollector.new.collect(body)
methods.each do |method|
clazz.add_method( method )
normalizer = Compilers::Normalizer.new(method)
normalizer = Passes::Normalizer.new(method)
method.normalize_source { |sourc| normalizer.process( sourc ) }
end
methods
@ -40,7 +40,7 @@ module Melon
def compile_methods(clazz , methods)
methods.each do |method|
typed_method = method.create_vm_method(clazz.instance_type)
code = Compilers::MethodCompiler.new(method).get_code
code = Passes::MethodCompiler.new(method).get_code
Vm::MethodCompiler.new( typed_method ).init_method.process( code)
end
end

View File

@ -1,7 +1,7 @@
require_relative "helper"
module Melon
module Compilers
module Passes
class TestLocalsCollector < MiniTest::Test
def setup

View File

@ -1,7 +1,7 @@
require_relative "helper"
module Melon
module Compilers
module Passes
class TestMethodCollector < MiniTest::Test
def setup

View File

@ -1,7 +1,7 @@
require_relative "helper"
module Melon
module Compilers
module Passes
class TestNormalizer < MiniTest::Test
def setup

View File

@ -1,7 +1,7 @@
require_relative "helper"
module Melon
module Compilers
module Passes
class TestTypeCollector < MiniTest::Test
def setup

View File

@ -1,4 +1,4 @@
require_relative "compilers/test_all"
require_relative "passes/test_all"
require_relative "fragments/test_all"
require_relative "test_ruby_method"
require_relative "test_compiler"