statement: if a > b and c or d < e and f or a = c then a = a + 1; In Polish: if or or and > a b c and < d e f = a c then set a + a 1 // Statement sees 'if' // 1: pick a new label, L1 // 2: use Jump_False to jump there if condition is false // Jump_False(R1, L1) sees 'or' // 1: use jump_true to avoid second test // Jump_True(R1, L2) sees 'or' // 1: use jump_true recursively // Jump_True(R1, L2) sees 'and' // 1: use jump_false to avoid second test // Jump_False(R1, L3) sees '>' // 1: comparison, let arith do the left // Arith(R1) sees 'a' LOAD R1, [a] // 2: and the right // Arith(R2) sees 'b' LOAD R2, [b] // 3: now just compare and jump if false COMP R1, R2 JCOND LEQ, L3 // 2: use jump_true to finish it off // Jump_True(R1, L2) sees 'c' LOAD R1, [c] COMP R1, 0 JCOND NEQ, L2 L3: // 2: use jump_true recursively again // Jump_True(R1, L2) sees 'and' // 1: use jump_false to avoid second test // Jump_False(R1, L4) sees '<' // 1: comparison, let arith do the left // Arith(R1) sees 'd' LOAD R1, [d] // 2: and the right // Arith(R2) sees 'e' LOAD R2, [e] // 3: now just compare and jump if false COMP R1, R2 JCOND GEQ, L4 // 2: use jump_true to finish it off // Jump_True(R1, L2) sees 'f' LOAD R1, [f] COMP R1, 0 JCOND NEQ, L2 L4: // 2: use jump_false to finish it off // Jump_False(R1, L1) sees '=' // 1: comparison, let arith do the left // Arith(R1) sees 'a' LOAD R1, [a] // 2: and the right // Arith(R2) sees 'c' LOAD R2, [c] // 3: now just compare and jump if false COMP R1, R2 JCOND NEQ, L1 L2: // If we get here, didn't jump to L1, so cond is true // 3: check the word else appears next // 4: Use statement to process the conditional statement // (I cut out the comments for set a + a 1) LOAD R1, [a] LOAD R2, 1 ADD R1, R2 STORE R1, [a] // 5: produce the label (L1) L1: // so this is where the if jumps to if the cond was false