Subleq: Difference between revisions
Content added Content deleted
Line 1,102: | Line 1,102: | ||
ReadChar |
ReadChar |
||
END Subleq.</lang> |
END Subleq.</lang> |
||
=={{header|Objeck}}== |
|||
{{trans|Java}} |
|||
<lang objeck>use System.IO; |
|||
class Sublet { |
|||
function : Main(args : String[]) ~ Nil { |
|||
mem := [ |
|||
15, 17, -1, 17, -1, -1, 16, 1, -1, 16, |
|||
3, -1, 15, 15, 0, 0, -1, 72, 101, 108, |
|||
108, 111, 44, 32, 119, 111, 114, 108, 100, 33, |
|||
10, 0]; |
|||
instructionPointer := 0; |
|||
do { |
|||
a := mem[instructionPointer]; |
|||
b := mem[instructionPointer + 1]; |
|||
if (a = -1) { |
|||
mem[b] := Console->ReadString()->Get(0); |
|||
instructionPointer += 3; |
|||
} |
|||
else if (b = -1) { |
|||
value := mem[a]->As(Char); |
|||
value->Print(); |
|||
instructionPointer += 3; |
|||
} |
|||
else { |
|||
mem[b] -= mem[a]; |
|||
if (mem[b] < 1) { |
|||
instructionPointer := mem[instructionPointer + 2]; |
|||
} |
|||
else { |
|||
instructionPointer += 3; |
|||
}; |
|||
}; |
|||
} |
|||
while (instructionPointer >= 0); |
|||
} |
|||
}</lang> |
|||
<pre> |
|||
Hello, world! |
|||
</pre> |
|||
=={{header|Oforth}}== |
=={{header|Oforth}}== |