class Lignite::SimpleAssembler

Acts like DirectCommands but instead of executing, assembles them to a RBF file

Public Class Methods

new() click to toggle source
# File lib/lignite/assembler.rb, line 116
def initialize
  @globals = Variables.new
  @locals = Variables.new
  @declarer = RbfDeclarer::Dummy.new

  @interp = BodyCompiler.new(@globals, @locals, @declarer)
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source

Delegate the ops to the {BodyCompiler},

Calls superclass method
# File lib/lignite/assembler.rb, line 135
def method_missing(name, *args, &block)
  super unless @interp.respond_to?(name)

  @interp.public_send(name, *args, &block)
end
respond_to_missing?(name, _include_private) click to toggle source
Calls superclass method
# File lib/lignite/assembler.rb, line 141
def respond_to_missing?(name, _include_private)
  @interp.respond_to?(name) || super
end
write(rbf_filename) click to toggle source
# File lib/lignite/assembler.rb, line 124
def write(rbf_filename)
  @interp.object_end
  vmthread = RbfObject.vmthread(body: @interp.bytes, local_bytes: @locals.bytesize)

  asm = Assembler.new
  asm.objects = [vmthread]
  asm.globals = @globals
  asm.write(rbf_filename)
end