more machinery to the machine
This commit is contained in:
parent
5add9c42f2
commit
8effcc866a
2
lib/parfait/object.rb
Normal file
2
lib/parfait/object.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class Object
|
||||
end
|
@ -42,13 +42,26 @@ module Virtual
|
||||
def self.boot
|
||||
machine = Machine.new
|
||||
machine.boot
|
||||
machine
|
||||
end
|
||||
|
||||
def read string
|
||||
syntax = @parser.parse_with_debug(string)
|
||||
Parser::Transform.new.apply(syntax)
|
||||
def boot
|
||||
# read all the files needed for a minimal system at compile
|
||||
classes = ["object"]
|
||||
classes.each do |clazz|
|
||||
bytes = File.read(File.join( File.dirname( __FILE__ ) , ".." , "parfait" , "#{clazz}.rb") )
|
||||
# expression = compile_main(bytes)
|
||||
end
|
||||
end
|
||||
|
||||
def compile_main bytes
|
||||
syntax = @parser.parse_with_debug(bytes)
|
||||
parts = Parser::Transform.new.apply(syntax)
|
||||
main = Virtual::MethodDefinition.main
|
||||
expressions = parts.compile( main , self.message )
|
||||
end
|
||||
|
||||
|
||||
# run the instruction stream given. Instructions are a graph and executing means traversing it.
|
||||
# If there is no next instruction the machine stops
|
||||
def run instruction
|
||||
|
@ -8,10 +8,8 @@ module VirtualHelper
|
||||
end
|
||||
|
||||
def check
|
||||
machine = Virtual::Machine.new
|
||||
parts = machine.read @string_input
|
||||
main = Virtual::MethodDefinition.main
|
||||
expressions = parts.compile( main, machine.message )
|
||||
machine = Virtual::Machine.boot
|
||||
expressions = machine.compile_main @string_input
|
||||
should = YAML.load(@output.gsub("RETURN_MARKER" , "\n"))
|
||||
assert_equal should , expressions , expressions.to_yaml.gsub("\n" , "RETURN_MARKER") + "\n" + expressions.to_yaml
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user