vm/codegen/instructions_gen.rb
# Using InstructionSet::OpCodes as a key, gather up all the implementation
# code into Implementation objects from instructions.rb and return it.
#
Using InstructionSet::OpCodes as a key, gather up all the implementation
code into Implementation objects from instructions.rb and return it.
Using InstructionSet :: OpCodes as a key gather up all the implementation code into Implementation objects from instructions . rb and return it .
def decode_methods
    pt = ParseTree.new(true)
    basic = InstructionSet::OpCodes.map do |ins|
      meth = method(ins.opcode) rescue nil
      if meth
        args = [nil] * meth.arity
        code = meth.call *args
        sexp = pt.parse_tree_for_method(Instructions, ins.opcode)
        flat = sexp.flatten
        line = flat[flat.index(:newline) + 1] + 1
        Implementation.new ins, sexp, line, code
      else
        nil
      end
    end
    return basic
  end
def decode_methods pt = ParseTree . new ( true ) basic = InstructionSet :: OpCodes . map do | ins | meth = method ( ins . opcode ) rescue nil if meth args = [ nil ] * meth . arity code = meth . call * args sexp = pt . parse_tree_for_method ( Instructions , ins . opcode ) flat = sexp . flatten line = flat [ flat . index ( :newline ) + 1 ] + 1 Implementation . new ins , sexp , line , code else nil end end return basic end
Using InstructionSet::OpCodes as a key, gather up all the implementation
code into Implementation objects from instructions.rb and return it.
Using InstructionSet :: OpCodes as a key gather up all the implementation code into Implementation objects from instructions . rb and return it .
# Be sure to call it with the right number of args, to get the code # out.