DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦2fbb72225⟧ Ada Source

    Length: 8192 (0x2000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Expression, seg_0381c9, seg_038ac1

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Bounded_String;
with Object;  
with Msg_Report;  
with Scanner;  
with Symbol_Table;
with String_Utilities;
with Unparse_Report;
with Value;

package body Expression is

    function Bs_Image (A_String : Scanner.B_String) return String
        renames Bounded_String.Image;

    procedure Bs_Copy (A_String : in out Scanner.B_String; A_Value : String)
        renames Bounded_String.Copy;

    function Su_Capitalize (A_String : String) return String
        renames String_Utilities.Capitalize;


    type Node_Structure is
        record
            Rule : Natural range 0 .. 1 := 0;  
            Valu : Value.Node := Value.Empty_Node;
            Iden : Scanner.B_String;
            Lign : Integer;
        end record;

    procedure Parse (N : in out Node; Error : out Boolean) is  
        use Scanner;
        Failed : Boolean := False;
    begin  
        Msg_Report.Information ("I enter in expression's parse");

        N := new Node_Structure;

        N.Lign := Scanner.Line_Number;

        if (Scanner.Symbol = L_Pour) then  
            Scanner.Next;
            if Scanner.Symbol = L_Identifier then
                Bs_Copy (N.Iden, Scanner.Value);
                Scanner.Next;
                if Scanner.Symbol = L_Prendre then
                    Scanner.Next;
                    if Value.Is_First (Scanner.Symbol) then
                        Value.Parse (N.Valu, Failed);
                    else
                        Failed := True;  
                        Msg_Report.Syntax_Error
                           ("incorrect follow of PRENDRE : ");

                    end if;
                else
                    Failed := True;
                    Msg_Report.Syntax_Error ("POUR expected, incorrect");  
                end if;  
            else
                Failed := True;  
                Msg_Report.Syntax_Error ("incorrect follow of POUR : ");
            end if;
        else
            N.Rule := 1;
            Value.Parse (N.Valu, Failed);  
        end if;

        Msg_Report.Information ("I leave expression's parse with failed = " &
                                Boolean'Image (Failed));

        Error := Failed;
    end Parse;

    procedure Unparse (N : Node) is

    begin
        case N.Rule is  
            when 0 =>  
                Unparse_Report.Write ("POUR ");  
                Unparse_Report.Write (Su_Capitalize (Bs_Image (N.Iden)) & " ");
                Unparse_Report.Write ("PRENDRE ");  
                Value.Unparse (N.Valu);

            when 1 =>
                Value.Unparse (N.Valu);
        end case;
    end Unparse;


    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        return T = L_Pour or else Value.Is_First (T);
    end Is_First;


    function Interpret (N : Node;
                        Inherited : Object.Reference := Object.Void_Reference)
                       return Object.Reference is
        Result : Object.Reference;
    begin

        Msg_Report.Information ("I enter in expression's interpret");

        Msg_Report.Set_Line_Number (N.Lign);

        case N.Rule is

            when 0 =>  
                Result := Value.Interpret (N.Valu);

                if Symbol_Table.Is_Found (N.Iden) then
                    Symbol_Table.Set_Info (N.Iden, Result);
                else
                    Symbol_Table.Insert (N.Iden, Result);  
                end if;

            when 1 =>
                Result := Value.Interpret (N.Valu);  
        end case;

        Msg_Report.Information ("I leave expression's interpret with result :");
        Msg_Report.Continue
           ("class = " & Object.Class'Image (Object.The_Class (Result)) &
            " ident = " & Integer'Image (Object.Identificator (Result)));

        return Result;
    end Interpret;
end Expression;

E3 Meta Data

    nblk1=7
    nid=2
    hdr6=a
        [0x00] rec0=25 rec1=00 rec2=01 rec3=01e
        [0x01] rec0=07 rec1=00 rec2=06 rec3=060
        [0x02] rec0=1a rec1=00 rec2=03 rec3=066
        [0x03] rec0=24 rec1=00 rec2=05 rec3=042
        [0x04] rec0=19 rec1=00 rec2=07 rec3=000
        [0x05] rec0=42 rec1=61 rec2=3b rec3=1b6
        [0x06] rec0=e5 rec1=44 rec2=00 rec3=01f
    tail 0x21531632e84e67d91e0a9 0x42a00088462060003
Free Block Chain:
  0x2: 0000  00 04 03 fc 80 07 52 75 6c 65 20 69 73 07 00 00  ┆      Rule is   ┆
  0x4: 0000  00 00 01 06 80 07 6c 74 20 3a 22 29 3b 07 00 1b  ┆      lt :");   ┆