#
#
# $Id: yarv.rb,v 1.1 2004/01/12 17:31:21 ko1 Exp $
# Create : K.S. 04/01/01 18:12:15
#
#

require 'yarvcore'
=begin

== YARVCore Module Image

module YARVCore
  def self.eval str
    VM.new.exec(YARVCore.parse(str))
  end

  def self.parse str
    InstructionSequence.new(str2node(str))
  end

  class InstructionSequence
    class Label
      def initialize name
        @name = name
      end
      attr_reader   :name
      attr_accessor :dst
    end

    class Instruction
      def initialize insn_id, line_no, operands = []
        @insn_id = insn_id
        @line_no = line_no
        @operands= operands
      end
      attr_reader :operand_size
      attr_reader :insn_id
      attr_reader :line_no
      
      def operand idx
        @operands[idx]
      end

      def make ...
      end
    end

    ##
    def initialize node
      @data = compile(node)
      @size = sizeof(@data)
    end
    
    def disasm
      disasssemble this instruction sequence
    end
    
    def self.compile node
      InstructionSequence.new compiled_node
    end
  end

  ## ??
  class VM
    class Thread
      def initialize
        set stack etc
      end
      
      def eval iseq
        execute instruction sequence
      end
    end
    
    def initialize
    end
    
    def eval iseq
      Thread.new(iseq)
    end
  end
end

=end



