DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦4d37c0bb5⟧ TextFile

    Length: 1598 (0x63e)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Lexical;
use Lexical;

separate (Semantique.Calcul)
procedure Postfixer (Un_Elem : Ptr_Elt) is  
    Oper : Operateur;


    type Priorite is range 0 .. 4;
    type Tab_Pr is array (Operateur) of Priorite;
    Pr_Pile : constant Tab_Pr :=
       Tab_Pr'('+' | '-' => 1, '*' => 2, 'm' | 'p' => 3, others => 0);
    Pr_Newop : constant Tab_Pr :=
       Tab_Pr'(Finop => 0, '+' | '-' => 1, '*' => 2, others => 4);
begin
    if Un_Elem.Isfact then
        Calculateur (Un_Elem);
    elsif Un_Elem.Op = Finop then
        while not Piloper.Empty (Pilop) loop
            Oper := Piloper.Top (Pilop);
            Piloper.Pop (Pilop);
            Calculateur (new Elt'(False, Oper));  
        end loop;  
    elsif Un_Elem.Op = ')' then
        loop
            Oper := Piloper.Top (Pilop);
            Piloper.Pop (Pilop);
            exit when Oper = '(' or Oper = Finop;
            Calculateur (new Elt'(False, Oper));
        end loop;
        if Oper = Finop then
            raise Par_Ferm;
        end if;
    else
        loop
            Oper := Piloper.Top (Pilop);
            Piloper.Pop (Pilop);
            exit when Pr_Newop (Un_Elem.Op) > Pr_Pile (Oper);
            Calculateur (new Elt'(False, Oper));
        end loop;
        Piloper.Push (Oper, Pilop);
        Piloper.Push (Un_Elem.Op, Pilop);
    end if;  
exception
    when Par_Ferm =>
        Erreurs.Ajouter ("Parenthese fermante incongrue.");
    when Err_Op =>
        Erreurs.Ajouter ("Operateur inconnu : " & Op_Inconnu);
    when Numeric_Error =>
        Erreurs.Ajouter ("Nombre trop grand........");
end Postfixer;