function O( opr:symbol; v1, v2 :Value ):Value;    { O :Value^2 -> Value }
   var abs1, abs2, intAns :integer; boolAns :boolean;
begin case opr of
      parallelsy: {...||...} O:=mkprocess1(paraprocessval,  v1,v2);
      choicesy:   {...|....} O:=mkprocess1(choiceprocessval,v1,v2);

      eq, ne, lt, le, gt, ge:
         begin if [v1^.tag] * [v2^.tag] * [intval, boolval, charval] <> [] then
               case v1^.tag of
               intval:  begin abs1:=v1^.n;       abs2:=v2^.n end;
               boolval: begin abs1:=ord(v1^.b);  abs2:=ord(v2^.b)  end;
               charval: begin abs1:=ord(v1^.ch); abs2:=ord(v2^.ch) end
               end
               else error('rel ops   ');
               case opr of
               eq: boolAns:=abs1= abs2;   ne: boolAns:=abs1<>abs2;
               le: boolAns:=abs1<=abs2;   lt: boolAns:=abs1< abs2;
               ge: boolAns:=abs1>=abs2;   gt: boolAns:=abs1> abs2
               end;
               O:=mkbool(boolAns)
         end;        
      plus, minus, times, over:
         begin if [v1^.tag, v2^.tag] = [intval] then
               case opr of
               plus:  intAns:=v1^.n +   v2^.n;
               minus: intAns:=v1^.n -   v2^.n;
               times: intAns:=v1^.n *   v2^.n;
               over:  intAns:=v1^.n div v2^.n
               end
               else error('arith opr ');
               O:=mkint(intAns)
         end;
      andsy, orsy:
         begin if [v1^.tag, v2^.tag] = [boolval] then
               case opr of
               andsy: boolAns:=v1^.b and v2^.b;
               orsy:  boolAns:=v1^.b or  v2^.b
               end
               else error('bool opr  ');
               O:=mkbool(boolAns)
         end;
      conssy: { deferred params } O:=cons(v1, v2)
      end
end {O};

{\fB Execute Binary Operators. \fP}
{ Do not remove: This program is released under Gnu `copyleft' General }
{ Public Licence (GPL)    -- L.Allison, CSSE, Monash Uni., .au, 7/2004 }

