update reader
This commit is contained in:
parent
9d0d5aa431
commit
33c62a7db1
@ -7,7 +7,7 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/ruby-in-ruby/crystal-reader.git
|
remote: https://github.com/ruby-in-ruby/crystal-reader.git
|
||||||
revision: 7e1c0d7f572256b351655798aadfd160ded07760
|
revision: 3a56ae1a8d96845bbb80f760626c8203d57cb1c3
|
||||||
specs:
|
specs:
|
||||||
crystal-reader (0.1.0)
|
crystal-reader (0.1.0)
|
||||||
|
|
||||||
|
@ -8,3 +8,4 @@ require_relative "module_expression"
|
|||||||
require_relative "operator_expressions"
|
require_relative "operator_expressions"
|
||||||
require_relative "return_expression"
|
require_relative "return_expression"
|
||||||
require_relative "while_expression"
|
require_relative "while_expression"
|
||||||
|
require_relative "expression_list"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Vm
|
module Virtual
|
||||||
# The Virtual Machine is a value based virtual machine in which ruby is implemented. While it is value based,
|
# The Virtual Machine is a value based virtual machine in which ruby is implemented. While it is value based,
|
||||||
# it resembles oo in basic ways of object encapsulation and method invokation, it is a "closed" / static sytem
|
# it resembles oo in basic ways of object encapsulation and method invokation, it is a "closed" / static sytem
|
||||||
# in that all types are know and there is no dynamic dispatch (so we don't bite our tail here).
|
# in that all types are know and there is no dynamic dispatch (so we don't bite our tail here).
|
||||||
@ -42,6 +42,8 @@ module Vm
|
|||||||
# storage is a linked list. Has the same api as a ha
|
# storage is a linked list. Has the same api as a ha
|
||||||
@bindings = List.new
|
@bindings = List.new
|
||||||
end
|
end
|
||||||
|
attr_reader :bindings
|
||||||
|
|
||||||
# run the instruction stream given. Instructions are a graph and executing means traversing it.
|
# run the instruction stream given. Instructions are a graph and executing means traversing it.
|
||||||
# If there is no next instruction the machine stops
|
# If there is no next instruction the machine stops
|
||||||
def run instruction
|
def run instruction
|
||||||
|
@ -11,10 +11,9 @@ module VirtualHelper
|
|||||||
parser = Parser::Crystal.new
|
parser = Parser::Crystal.new
|
||||||
syntax = parser.parse_with_debug(@string_input)
|
syntax = parser.parse_with_debug(@string_input)
|
||||||
parts = Parser::Transform.new.apply(syntax)
|
parts = Parser::Transform.new.apply(syntax)
|
||||||
|
machine = Virtual::Machine.new
|
||||||
parts.each_with_index do |part,index|
|
puts parts.class.inspect
|
||||||
expr = part.compile( @object_space.context )
|
parts.compile(machine.bindings)
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user