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

⟦58193144b⟧ TextFile

    Length: 1922 (0x782)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Lex, Error, Symbol, Debug;
with Term;
package body Expression is

    procedure Parse (N : in out Binary_Tree.Node; Success : in out Boolean) is
        N1, N2 : Binary_Tree.Node;
        Ok : Boolean := True;
    begin  
        N1 := new Binary_Tree.Node_Structure;
        N := N1;
        Success := True;
        Term.Parse (N1.Left_Son, Ok);
        while (Lex.Current_Token_In ((Lex.Plus, Lex.Minus))) loop
            N2 := new Binary_Tree.Node_Structure;
            N1.Right_Son := N2;
            case Lex.Get is
                when Lex.Plus =>
                    Debug.Put (530);
                    Lex.Next;  
                    N1.The_Type := Binary_Tree.Add_Type;
                    Term.Parse (N2.Left_Son, Ok);
                    Success := Success and Ok;
                when Lex.Minus =>
                    Debug.Put (531);
                    Lex.Next;  
                    N1.The_Type := Binary_Tree.Sub_Type;
                    Term.Parse (N2.Left_Son, Ok);
                    Success := Success and Ok;
                when others =>
                    Error.Append (2);
                    Success := False;
            end case;  
            N1 := N2;
        end loop;
    end Parse;



    procedure Generate (N : in out Binary_Tree.Node;
                        The_Value : in out Natural) is
        Value1, Value2 : Natural;
    begin
        Term.Generate (N.Left_Son, Value1);
        if Binary_Tree."=" (N.Right_Son, null) then
            The_Value := Value1;
        else  
            Generate (N.Right_Son, Value2);
            case N.The_Type is
                when Binary_Tree.Add_Type =>
                    The_Value := Value1 + Value2;
                when Binary_Tree.Sub_Type =>
                    The_Value := Value1 - Value2;
                when others =>
                    null;
            end case;
        end if;
    end Generate;

end Expression;