Developed for Kulyukin's CS5000
// 0. primitive instructions only
// 1. anything following the comment token "//" up to a
// newline are ignored.
// 2. by default, a computation that takes more than 500_000
// "procedures", it will be halted.
// 3. the implicit exit label "E1" exists; thus to exit
// prematurely, "GOTO E1".
// 4. input your initial snapshot in the "variables" map
// on the Program in the compiled JS output
// 5. for a more detailed view on the grammar, it's at
// /godel/grammar.peg
// THIS PROGRAM COMPUTES X1 + X2
// Y <- X1
[ A1 ] IF X1 != 0 GOTO A2
GOTO B1
[ A2 ] X1 <- X1 - 1
Y <- Y + 1
GOTO A1
// Z1 <- X2
[ B1 ] IF X2 != 0 GOTO B2
GOTO C1
[ B2 ] X2 <- X2 - 1
Z1 <- Z1 + 1
GOTO B1
// Y <- Y + Z1
[ C1 ] IF Z1 != 0 GOTO C2
GOTO E1
[ C2 ] Z1 <- Z1 - 1
Y <- Y + 1
GOTO C1
Sequence:
Number: