Decoder:
PUBLIC
PROC []
RETURNS [table: AlpsBool.TableOfVariables] = {
pBar: AlpsBool.Expression ← AlpsBool.true;
gBar: AlpsBool.Expression ← AlpsBool.true;
a, b: AlpsBool.Expression;
plus, or, and, xor: AlpsBool.Expression;
table ← AlpsBool.InitTableOfVariables[4+1];
table[1].name ← "a";
table[2].name ← "b";
table[3].name ← "op1";
table[4].name ← "op2";
a ← Var[1]; b ← Var[2];
plus ← And[table, Var[3], Var[4]];
xor ← And[table, Not[Var[3]], Var[4]];
and ← And[table, Var[3], Not[Var[4]]];
or ← And[table, Not[Var[3]], Not[Var[4]]];
pBar ← If[table, plus, Xor[table, a, Not[b]], pBar];
gBar ← If[table, plus, Or[table, Not[a], Not[b]], gBar];
pBar ← If[table, or, Nor[table, a, b], pBar];
pBar ← If[table, and, Not[And[table, a, b]], pBar];
pBar ← If[table, xor, Xor[table, a, Not[b]], pBar];
AlpsBool.AddOutput[table, NEW[AlpsBool.OutputRec ← [expr: pBar, name: "pBar"]]];
AlpsBool.AddOutput[table, NEW[AlpsBool.OutputRec ← [expr: gBar, name: "gBar"]]];
};
Decoder: PUBLIC PROC [] RETURNS [table: AlpsBool.TableOfVariables] = {
pBar, gBar: AlpsBool.Expression ← AlpsBool.true;
a, b: AlpsBool.Expression;
table ← AlpsBool.InitTableOfVariables[7+1];
table[1].name ← "a";
table[2].name ← "b";
table[3].name ← "op+";
table[4].name ← "op-";
table[5].name ← "opOr";
table[6].name ← "opAnd";
table[7].name ← "opXor";
a ← Var[1]; b ← Var[2];
pBar ← If[table, Var[3], Xor[table, a, Not[b]], pBar];
gBar ← If[table, Var[3], Or[table, Not[a], Not[b]], gBar];
pBar ← If[table, Var[4], Xor[table, a, b], pBar];
gBar ← If[table, Var[4], Or[table, Not[a], b], gBar];
pBar ← If[table, Var[5], Nor[table, a, b], pBar];
pBar ← If[table, Var[6], Not[And[table, a, b]], pBar];
pBar ← If[table, Var[7], Xor[table, a, Not[b]], pBar];
AlpsBool.AddOutput[table, NEW[AlpsBool.OutputRec ← [expr: pBar, name: "pBar"]]];
AlpsBool.AddOutput[table, NEW[AlpsBool.OutputRec ← [expr: gBar, name: "gBar"]]];
};