module SyntaxTree::YARV

def self.calldata(

A convenience method for creating a CallData object.
def self.calldata(
  method,
  argc = 0,
  flags = CallData::CALL_ARGS_SIMPLE,
  kw_arg = nil
)
  CallData.new(method, argc, flags, kw_arg)
end

def self.compile(source, options = Compiler::Options.new)

Compile the given source into a YARV instruction sequence.
def self.compile(source, options = Compiler::Options.new)
  SyntaxTree.parse(source).accept(Compiler.new(options))
end

def self.interpret(source, options = Compiler::Options.new)

Compile and interpret the given source.
def self.interpret(source, options = Compiler::Options.new)
  iseq = RubyVM::InstructionSequence.compile(source, **options)
  iseq = InstructionSequence.from(iseq.to_a)
  VM.new.run_top_frame(iseq)
end