mame/quine-relay · error · RuntimeError

Integer expected

Error message

Integer expected

What it means

Error "Integer expected" thrown in mame/quine-relay.

Source

Thrown at vendor/whitespace.rb:48

names = RE.names.map {|n| n.to_sym } - [:num, :label]
code, labels = [], {}
File.read($*[0]).gsub(/[^ \t\n]/m, "").tr(" \t\n", "012").scan(RE) do
  insn = names.find {|n| $~[n] }
  arg = $~[:num]
  arg = arg[1..-1].to_i(2) * (arg[0] == ?0 ? 1 : -1) if arg
  arg = $~[:label] if $~[:label]
  raise "Unrecognised input" if insn == :error
  insn == :mark ? labels[arg] = code.size : code << [insn, arg]
end

def read_int
  s = ""
  while true
    ch = $stdin.getc
    case ch
    when /\d+/ then s << ch
    when /\s+/ then break
    else raise "Integer expected"
    end
  end
  s.to_i
end

pc, call, stack, heap = 0, [], [], Hash.new(0)
loop do
  insn, arg = code[pc]
  pc += 1
  case insn
  when :push  then stack << arg
  when :dup   then stack << stack.last
  when :copy  then stack << stack[-arg - 1]
  when :slide then n = stack.pop; stack.pop(arg); stack << n
  when :swap  then n = stack.pop; m = stack.pop; stack << n << m
  when :pop   then stack.pop
  when :add   then n = stack.pop; stack << stack.pop + n
  when :sub   then n = stack.pop; stack << stack.pop - n

View on GitHub (pinned to c2aa5098d3)

When it happens

Trigger: Thrown at vendor/whitespace.rb:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mame/quine-relay@c2aa5098d3 (2026-08-21). Data as JSON: /api/errors/c8754dd327ca75f5. Report an issue: GitHub.