renaming mom builtin to macro
This commit is contained in:
parent
5ea91df4c1
commit
616dd3487c
@ -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
|
@ -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)
|
@ -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)
|
@ -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
|
@ -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
|
@ -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
|
@ -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]
|
@ -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
|
@ -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
|
@ -24,7 +24,7 @@ module Mom
|
||||
end
|
||||
end
|
||||
end
|
||||
class IntOperator < Instruction
|
||||
class IntOperator < Macro
|
||||
attr_reader :operator
|
||||
def initialize(name , operator)
|
||||
super(name)
|
@ -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
|
@ -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]
|
@ -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]
|
@ -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"
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,7 +1,7 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
module Builtin
|
||||
module Macro
|
||||
class IntMath < Minitest::Test
|
||||
include Ticker
|
||||
def setup
|
||||
|
@ -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)
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user