remove soml parser from tests
This commit is contained in:
parent
e2236cf703
commit
4cd979e3e9
@ -1,6 +1,6 @@
|
|||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
module Soml
|
module Typed
|
||||||
class TestWord < MiniTest::Test
|
class TestWord < MiniTest::Test
|
||||||
include Fragments
|
include Fragments
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ class TestRunner < MiniTest::Test
|
|||||||
string = File.read(file)
|
string = File.read(file)
|
||||||
parser = Parser::Salama.new
|
parser = Parser::Salama.new
|
||||||
object_space = Register::Program.new "Arm"
|
object_space = Register::Program.new "Arm"
|
||||||
|
#TODO : files would have to include s-expressions now
|
||||||
|
# those can be obtained with to_code utility in soml-parser
|
||||||
syntax = parser.parse_with_debug(string, reporter: Parslet::ErrorReporter::Deepest.new)
|
syntax = parser.parse_with_debug(string, reporter: Parslet::ErrorReporter::Deepest.new)
|
||||||
assert syntax
|
assert syntax
|
||||||
parts = Parser::Transform.new.apply(syntax)
|
parts = Parser::Transform.new.apply(syntax)
|
@ -1,10 +1,11 @@
|
|||||||
require_relative "../helper"
|
require_relative "../helper"
|
||||||
|
|
||||||
class HelloTest < MiniTest::Test
|
class HelloTest < MiniTest::Test
|
||||||
|
include AST::Sexp
|
||||||
|
|
||||||
def check
|
def check
|
||||||
machine = Register.machine.boot
|
machine = Register.machine.boot
|
||||||
machine.parse_and_compile @string_input
|
Typed.compile( @input )
|
||||||
machine.collect
|
machine.collect
|
||||||
machine.translate_arm
|
machine.translate_arm
|
||||||
writer = Elf::ObjectWriter.new
|
writer = Elf::ObjectWriter.new
|
||||||
@ -19,6 +20,20 @@ class Object
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
|
@input = s(:statements,
|
||||||
|
s(:class, :Object,
|
||||||
|
s(:derives, nil),
|
||||||
|
s(:statements,
|
||||||
|
s(:function, :Integer,
|
||||||
|
s(:name, :main),
|
||||||
|
s(:parameters),
|
||||||
|
s(:statements,
|
||||||
|
s(:return,
|
||||||
|
s(:call,
|
||||||
|
s(:name, :putstring),
|
||||||
|
s(:arguments),
|
||||||
|
s(:receiver,
|
||||||
|
s(:string, "Hello again\\n")))))))))
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,13 +2,11 @@ require_relative "../../helper"
|
|||||||
require "register/interpreter"
|
require "register/interpreter"
|
||||||
|
|
||||||
module Ticker
|
module Ticker
|
||||||
|
include AST::Sexp
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
machine = Register.machine.boot
|
machine = Register.machine.boot
|
||||||
syntax = Parser::Salama.new.parse_with_debug(@string_input, reporter: Parslet::ErrorReporter::Deepest.new)
|
Typed.compile( @input )
|
||||||
parts = Parser::Transform.new.apply(syntax)
|
|
||||||
#puts parts.inspect
|
|
||||||
Typed.compile( parts )
|
|
||||||
machine.collect
|
machine.collect
|
||||||
@interpreter = Register::Interpreter.new
|
@interpreter = Register::Interpreter.new
|
||||||
@interpreter.start Register.machine.init
|
@interpreter.start Register.machine.init
|
||||||
|
@ -11,6 +11,18 @@ class Space
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
|
@input = s(:statements,
|
||||||
|
s(:class, :Space,
|
||||||
|
s(:derives, nil),
|
||||||
|
s(:statements,
|
||||||
|
s(:function, :Integer,
|
||||||
|
s(:name, :main),
|
||||||
|
s(:parameters),
|
||||||
|
s(:statements,
|
||||||
|
s(:return,
|
||||||
|
s(:operator_value, :+,
|
||||||
|
s(:int, 5),
|
||||||
|
s(:int, 7))))))))
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,6 +19,40 @@ class Space
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
|
@input = s(:statements,
|
||||||
|
s(:class, :Space,
|
||||||
|
s(:derives, nil),
|
||||||
|
s(:statements,
|
||||||
|
s(:function, :Integer,
|
||||||
|
s(:name, :itest),
|
||||||
|
s(:parameters,
|
||||||
|
s(:parameter, :Integer, :n)),
|
||||||
|
s(:statements,
|
||||||
|
s(:if_statement, :zero,
|
||||||
|
s(:condition,
|
||||||
|
s(:operator_value, :-,
|
||||||
|
s(:name, :n),
|
||||||
|
s(:int, 12))),
|
||||||
|
s(:true_statements,
|
||||||
|
s(:call,
|
||||||
|
s(:name, :putstring),
|
||||||
|
s(:arguments),
|
||||||
|
s(:receiver,
|
||||||
|
s(:string, "then")))),
|
||||||
|
s(:false_statements,
|
||||||
|
s(:call,
|
||||||
|
s(:name, :putstring),
|
||||||
|
s(:arguments),
|
||||||
|
s(:receiver,
|
||||||
|
s(:string, "else"))))))),
|
||||||
|
s(:function, :Integer,
|
||||||
|
s(:name, :main),
|
||||||
|
s(:parameters),
|
||||||
|
s(:statements,
|
||||||
|
s(:call,
|
||||||
|
s(:name, :itest),
|
||||||
|
s(:arguments,
|
||||||
|
s(:int, 20))))))))
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,7 +11,20 @@ class Space
|
|||||||
return #{2**31} * #{2**31}
|
return #{2**31} * #{2**31}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
HERE
|
HERE
|
||||||
|
@input = s(:statements,
|
||||||
|
s(:class, :Space,
|
||||||
|
s(:derives, nil),
|
||||||
|
s(:statements,
|
||||||
|
s(:function, :Integer,
|
||||||
|
s(:name, :main),
|
||||||
|
s(:parameters),
|
||||||
|
s(:statements,
|
||||||
|
s(:return,
|
||||||
|
s(:operator_value, :*,
|
||||||
|
s(:int, 2147483648),
|
||||||
|
s(:int, 2147483648))))))))
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,6 +11,18 @@ class Space
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
|
@input = s(:statements,
|
||||||
|
s(:class, :Space,
|
||||||
|
s(:derives, nil),
|
||||||
|
s(:statements,
|
||||||
|
s(:function, :Integer,
|
||||||
|
s(:name, :main),
|
||||||
|
s(:parameters),
|
||||||
|
s(:statements,
|
||||||
|
s(:return,
|
||||||
|
s(:operator_value, :+,
|
||||||
|
s(:int, 4611686018427387903),
|
||||||
|
s(:int, 1))))))))
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,6 +11,19 @@ class Space
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
|
@input = s(:statements,
|
||||||
|
s(:class, :Space,
|
||||||
|
s(:derives, nil),
|
||||||
|
s(:statements,
|
||||||
|
s(:function, :Integer,
|
||||||
|
s(:name, :main),
|
||||||
|
s(:parameters),
|
||||||
|
s(:statements,
|
||||||
|
s(:call,
|
||||||
|
s(:name, :putstring),
|
||||||
|
s(:arguments),
|
||||||
|
s(:receiver,
|
||||||
|
s(:string, "Hello again"))))))))
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user