All pastes #454579 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-23 18:15 UTC
rendered paste body
// Expression - ...description...
procedure Expression;
  // Term - ...description...
  procedure Term;
    // Factor - ...description...
    procedure Factor;
    begin
      if Token = _lparen then
      begin
        Take(_lparen);
        Expression;
        Take(_rparen)
      end
      else if Token = _number then
        NextToken
      else
        Error(1)
    end;
    // Factor
  begin
    Factor;

    while Token in [_mul, _div] do
    begin
      NextToken;
      Factor
    end
  end;
  // Term
begin
  Term;

  while Token in [_plus, _minus] do
  begin
    NextToken;
    Factor
  end
end;
// Expression