hacking to get list of expressions to work (shudder)
This commit is contained in:
parent
7341586d15
commit
db22966de9
@ -20,12 +20,19 @@ class TestRunner < MiniTest::Test
|
|||||||
def execute file
|
def execute file
|
||||||
string = File.read(file)
|
string = File.read(file)
|
||||||
parser = Parser::Composed.new
|
parser = Parser::Composed.new
|
||||||
syntax = parser.parse_with_debug(string)
|
|
||||||
program = Vm::Program.new "Arm"
|
program = Vm::Program.new "Arm"
|
||||||
main = Parser::Transform.new.apply(syntax)
|
parts = string.split "SPLIT"
|
||||||
|
parts.each_with_index do |part,index|
|
||||||
|
puts "parsing #{index}=#{part}"
|
||||||
program.main = main.compile( program.context )
|
syntax = parser.parse_with_debug(part)
|
||||||
|
funct = Parser::Transform.new.apply(syntax)
|
||||||
|
expr = funct.compile( program.context )
|
||||||
|
if index = parts.length
|
||||||
|
program.main = expr
|
||||||
|
else
|
||||||
|
raise "should be function definition for now" unless expr.is_a? Function
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
program.link_at( 0 , program.context )
|
program.link_at( 0 , program.context )
|
||||||
|
|
||||||
@ -38,7 +45,7 @@ class TestRunner < MiniTest::Test
|
|||||||
writer.set_text assembly.string
|
writer.set_text assembly.string
|
||||||
writer.save(file.gsub(".rb" , ".o"))
|
writer.save(file.gsub(".rb" , ".o"))
|
||||||
|
|
||||||
puts program.to_yaml
|
# puts program.to_yaml
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user