Move builtin wholesale to Mom

Since Builtin generates risc, just like mom instructions, it was a design mistake to put builtin into risc in the first place. Now that borders are coming more into focus, it make much more sense to have the builtin in mom.
In fact the instructions should be moved out and a seperate invocation mechanism used , so functions can be parsed, not generated (wip)
This commit is contained in:
2019-08-12 12:36:32 +03:00
parent a4b6f29834
commit fa0aa30386
20 changed files with 40 additions and 30 deletions

View File

@ -0,0 +1,8 @@
# Builtin Testing
Mostly testing that
- functions exist
- they compile
- basic length tests (no "contents")
Functionality is tested by interpreter over in interpreter dir

View File

@ -1,12 +1,7 @@
require_relative "../helper"
module Risc
module Mom
module Builtin
class BuiltinTest < MiniTest::Test
include Ticker
def setup
end
end
class BootTest < MiniTest::Test
def setup
Parfait.boot!(Parfait.default_test_options)

View File

@ -1,6 +1,6 @@
require_relative "helper"
module Risc
module Mom
module Builtin
class TestIntDiv4 < BootTest
def setup

View File

@ -1,6 +1,6 @@
require_relative "helper"
module Risc
module Mom
module Builtin
class TestObjectFunctionGet < BootTest
def setup

View File

@ -1,6 +1,6 @@
require_relative "helper"
module Risc
module Mom
module Builtin
class TestWordPut < BootTest
def setup

View File

@ -1,6 +1,6 @@
require_relative "helper"
module Risc
module Mom
class TestBuiltinFunction < MiniTest::Test
def setup

View File

@ -1,9 +1,12 @@
require_relative "helper"
# TODO move these to interpreter dir
module Risc
module Mom
module Builtin
class IntCmp < BuiltinTest
include Ticker
def setup
end
def test_smaller_true
run_main_return "4 < 5"

View File

@ -1,8 +1,11 @@
require_relative "helper"
module Risc
module Mom
module Builtin
class IntMath < BuiltinTest
include Ticker
def setup
end
def test_add
run_main_return "5 + 5"

View File

@ -8,7 +8,7 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
Risc::Builtin.boot_functions
Mom.boot!
@compiler = compile_first_method( send_method )
@ins = @compiler.mom_instructions.next
end