Separate inputs with commas: 3, 5 means
X1 = 3 and X2 = 5.
Loading Wasm...
X1, the second to X2,
and so on: 3, 5 starts the program with
X1 = 3 and X2 = 5.
OutputVar is the result.
Inputs must be whole numbers of 0 or higher. Any variable without a
value starts at 0, so with 3 as input, X2 is
0, and with an empty field, every variable is 0.
Inputs don't go in the program itself: X1 <- 20 is not
valid, because programs can only add or subtract 1.
The example computes Y = 2 * X1. It uses Z1 to
make unconditional jumps, and jumps to the unused label E
to halt. It takes 6 * X1 + 3 steps, so raise Max steps for
inputs above 82.
V <- V + 1,
V <- V - 1, V <- V and
IF V != 0 GOTO L. Both sides of an assignment must use
the same variable.
X1, X2, ... are input
variables, all Z1, Z2, ... are local
variables and Y is the output variable. X
means X1 and Z means Z1.
A to E, optionally numbered,
written before a statement as [A] or [B2].
A means A1.
V - 1 leaves 0 at
0.
GOTO to a label that doesn't exist.
Each trace line shows the next instruction number and every variable
in the program or the inputs: OutputVar is Y,
InputVar 1 is X1 and
LocalVar 1 is Z1.
This is not the full L language as Martin Davis defines it. There, variables hold arbitrarily large natural numbers and a program can run forever. This runner is finite: every run stops after Max steps, which is limited to the 32-bit maximum of 2147483647, and all values have to fit in the browser's memory. A trace that stops at Max steps doesn't tell you whether the program would have halted.