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:
8
test/mom/builtin/README.md
Normal file
8
test/mom/builtin/README.md
Normal 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
|
@ -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)
|
@ -1,6 +1,6 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Risc
|
||||
module Mom
|
||||
module Builtin
|
||||
class TestIntDiv4 < BootTest
|
||||
def setup
|
@ -1,6 +1,6 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Risc
|
||||
module Mom
|
||||
module Builtin
|
||||
class TestObjectFunctionGet < BootTest
|
||||
def setup
|
@ -1,6 +1,6 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Risc
|
||||
module Mom
|
||||
module Builtin
|
||||
class TestWordPut < BootTest
|
||||
def setup
|
@ -1,6 +1,6 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Risc
|
||||
module Mom
|
||||
class TestBuiltinFunction < MiniTest::Test
|
||||
|
||||
def setup
|
@ -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"
|
@ -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"
|
@ -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
|
||||
|
Reference in New Issue
Block a user