renaming mom builtin to macro

This commit is contained in:
Torsten Rüger 2019-09-11 20:17:43 +03:00
parent 5ea91df4c1
commit 616dd3487c
55 changed files with 49 additions and 47 deletions

View File

@ -9,12 +9,14 @@ module Mom
end
end
end
class Macro < Instruction
end
end
require_relative "builtin/space"
require_relative "builtin/integer"
require_relative "builtin/object"
require_relative "builtin/word"
require_relative "macro/space"
require_relative "macro/integer"
require_relative "macro/object"
require_relative "macro/word"
module Mom
module Builtin

View File

@ -29,7 +29,7 @@ module Mom
end
end
end
class Comparison < ::Mom::Instruction
class Comparison < Macro
attr_reader :operator
def initialize(name , operator)
super(name)

View File

@ -62,7 +62,7 @@ module Mom
end
end
end
class Div10 < ::Mom::Instruction
class Div10 < Macro
def to_risc(compiler)
s = "div_10 "
builder = compiler.builder(compiler.source)

View File

@ -16,7 +16,7 @@ module Mom
end
end
end
class Div4 < ::Mom::Instruction
class Div4 < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
integer_tmp = builder.allocate_int

View File

@ -9,7 +9,7 @@ module Mom
end
end
end
class Exit < ::Mom::Instruction
class Exit < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
builder.prepare_int_return # makes integer_tmp variable as return

View File

@ -16,7 +16,7 @@ module Mom
end
end
end
class GetInternalByte < ::Mom::Instruction
class GetInternalByte < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
integer_tmp = builder.allocate_int

View File

@ -12,7 +12,7 @@ module Mom
end
end
end
class GetInternalWord < Instruction
class GetInternalWord < Macro
def to_risc(compiler)
compiler.builder(compiler.source).build do
object! << message[:receiver]

View File

@ -32,7 +32,7 @@ module Mom
end
end
end
class Init < ::Mom::Instruction
class Init < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
builder.build do

View File

@ -9,7 +9,7 @@ module Mom
end
end
end
class MethodMissing < ::Mom::Instruction
class MethodMissing < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
builder.prepare_int_return # makes integer_tmp variable as return

View File

@ -24,7 +24,7 @@ module Mom
end
end
end
class IntOperator < Instruction
class IntOperator < Macro
attr_reader :operator
def initialize(name , operator)
super(name)

View File

@ -13,7 +13,7 @@ module Mom
end
end
end
class Putstring < ::Mom::Instruction
class Putstring < Macro
def to_risc(compiler)
builder = compiler.builder(compiler.source)
builder.prepare_int_return # makes integer_tmp variable as return

View File

@ -15,7 +15,7 @@ module Mom
end
end
end
class SetInternalByte < ::Mom::Instruction
class SetInternalByte < Macro
def to_risc(compiler)
compiler.builder(compiler.source).build do
word! << message[:receiver]

View File

@ -14,7 +14,7 @@ module Mom
end
end
end
class SetInternalWord < ::Mom::Instruction
class SetInternalWord < Macro
def to_risc(compiler)
compiler.builder(compiler.source).build do
object! << message[:receiver]

View File

@ -23,4 +23,4 @@ require_relative "mom_collection"
require_relative "callable_compiler"
require_relative "method_compiler"
require_relative "block_compiler"
require_relative "builtin"
require_relative "macro"

View File

@ -1,5 +1,5 @@
module Vool
module Builtin
module Macro
def self.boot_methods(options)
return if options[:boot_methods] == false
load_builtin( :int_plus )

View File

@ -39,7 +39,7 @@ module Vool
check = Mom::NotSameCheck.new(compile_method , runtime_method, ok_label)
# TODO? Maybe create mom instructions for this
#builder = compiler.builder("yield")
#Risc::Builtin.exit_sequence(builder)
#Risc::Macro.exit_sequence(builder)
#check << builder.built
check << ok_label
end

View File

@ -2,7 +2,7 @@ require_relative "../helper"
# TODO move these to interpreter dir
module Risc
module Builtin
module Macro
class IntCmp < Minitest::Test
include Ticker
def setup

View File

@ -1,7 +1,7 @@
require_relative "../helper"
module Risc
module Builtin
module Macro
class IntMath < Minitest::Test
include Ticker
def setup

View File

@ -1,7 +1,7 @@
require_relative "../helper"
module RubyX
module BuiltinHelper
module MacroHelper
def setup
whole ="class Space;def main(arg);return;end;end;" + source
@mom = RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(whole)

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestIntegerSame < MiniTest::Test
include BuiltinHelper
include MacroHelper
def op ; :== ; end
def len ; 25 ; end
def source

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestIntegerDiv10 < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Integer

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestIntegerDiv4 < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Integer

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestIntegerPlus < MiniTest::Test
include BuiltinHelper
include MacroHelper
def op ; :+ ; end
def source
<<GET

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestObjectExit < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Object

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestObjectGet < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Object

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestObjectInit < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Object

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestObjectMissing < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Space

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestObjectGet < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Object

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestWordGet < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Word

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestWordPutstring < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Word

View File

@ -1,9 +1,9 @@
require_relative "helper"
module RubyX
module Builtin
module Macro
class TestWordSet < MiniTest::Test
include BuiltinHelper
include MacroHelper
def source
<<GET
class Word

View File

@ -6,7 +6,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
@code = Builtin.boot_methods({})
@code = Macro.boot_methods({})
end
def as_ruby
@ruby = Ruby::RubyCompiler.compile(@code)