small rename

This commit is contained in:
Torsten Ruger
2017-01-14 19:52:16 +02:00
parent bd78a2d555
commit 01fe3b4b04
5 changed files with 12 additions and 12 deletions

View File

@ -6,7 +6,7 @@ require_relative "compiler/ruby_method"
module Melon
class Compiler < AST::Processor
class Compiler < TotalProcessor
def self.compile( input )
ast = Parser::Ruby22.parse( input )
@ -29,14 +29,8 @@ module Melon
end
end
def handler_missing(node)
# raise "Oh"
node.children.each do |kid |
process(kid) if kid.is_a?(AST::Node)
end
end
private
def get_name( statement )
return nil unless statement
statement.children[1]

View File

@ -54,12 +54,18 @@ module Vm
# Expressions use registers and return the register where their value is stored.
# Helper function to create a new compiler and compie the statement(s)
def self.compile statement
# Statement must be and AST::Node as generated by s expressions
def self.compile_ast( statement )
compiler = MethodCompiler.new
code = Vm.ast_to_code statement
compiler.process code
end
def self.compile_method( method )
compiler = new(method)
compiler.process( code )
end
class MethodCompiler
CompilerModules.each do |mod|
include Vm.const_get( mod.camelize )