1define(`IFEQ', `2$2 := $2 - $1;3if $2 then4 $45else6 $37end8')910define(`AND', `11IFEQ(1, $1, IFEQ(1, $2, rs := 1, rs := 0), rs := 0)12')1314define(`OR', `15IFEQ(1, $1, rs := 1, IFEQ(1, $2, rs := 1, rs := 0))16')1718define(`NOT',19IFEQ(1, $1, rs := 0, rs := 1)20)2122# Valid boolean values are 0 and 1, however, user input is not verified.23# 0 means false in this case and 1 means true. E.g. AND(1, 1) sets rs to 1.2425let af := 0; # First boolean value.26let as := 0; # Second boolean value only read for binary operations.2728# Boolean operator:29# 0 -> NOT (unarry operator)30# 1 -> AND (binary operator)31# 2 -> OR (binary operator)32let op := 0;3334# Result as a boolean value.35let rs := 0;3637? af;38? op;3940let opcopy := op;41IFEQ(0, op,42 NOT(af),43 rs := 0 - 1);44op := opcopy;4546if rs + 1 then47 ! rs48else49 ? as;5051 IFEQ(1, op,52 AND(af, as),53 rs := 0 - 1);54 op := opcopy;5556 if rs + 1 then57 ! rs58 else59 IFEQ(2, op,60 OR(af, as),61 rs := 0 - 1);62 op := opcopy;6364 ! rs65 end66end