\util.g proc nonrec rdch() byte: char c; if read(c) then pretend(c, byte) else case ioerror() incase CH_MISSING: readln(); 10 default: 0 esac fi corp proc nonrec wrch(byte b) void: if b=10 then writeln() else write(pretend(b, char)) fi corp proc nonrec main() void: [16384] int mem; file() srcfile; channel input text srcch; *char fname; int a, b, c, i; byte iob; BlockFill(pretend(&mem[0], *byte), sizeof(byte), 0); fname := GetPar(); if fname = nil then writeln("usage: SUBLEQ filename"); exit(1); fi; if not open(srcch, srcfile, fname) then writeln("Cannot open input file"); exit(1) fi; i := 0; while read(srcch; mem[i]) do i := i + 1 od; close(srcch); i := 0; while i>=0 do a := mem[i]; b := mem[i+1]; c := mem[i+2]; i := i + 3; if a=-1 then mem[b] := rdch() elif b=-1 then wrch(mem[a]) else mem[b] := mem[b] - mem[a]; if mem[b] <= 0 then i := c fi fi od corp