Pascal



              

- 5


      LoadConst(-GetNum)

   else begin

      Factor;

      Negate;

   end;

end;

{--------------------------------------------------------------}

{ Parse and Translate a Leading Factor }

procedure FirstFactor;

begin

   case Look of

     '+': begin

             Match('+');

             Factor;

          end;

     '-': NegFactor;

   else  Factor;

   end;

end;

{--------------------------------------------------------------}

{ Recognize and Translate a Multiply }

procedure Multiply;

begin

   Match('*');

   Factor;

   PopMul;

end;

{-------------------------------------------------------------}

{ Recognize and Translate a Divide }

procedure Divide;

begin

   Match('/');

   Factor;

   PopDiv;

end;

{---------------------------------------------------------------}

{ Common Code Used by Term and FirstTerm }

procedure Term1;

begin

   while IsMulop(Look) do begin

      Push;

      case Look of

       '*': Multiply;

       '/': Divide;

      end;

   end;

end;

{---------------------------------------------------------------}

{ Parse and Translate a Math Term }

procedure Term;

begin

   Factor;

   Term1;

end;

{---------------------------------------------------------------}

{ Parse and Translate a Leading Term }

procedure FirstTerm;

begin

   FirstFactor;

   Term1;

end;

{--------------------------------------------------------------}

{ Recognize and Translate an Add }