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

⟦411bdb9cd⟧ TextFile

    Length: 2365 (0x93d)
    Types: TextFile
    Names: »B«

Derivation

└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Expression, More_Statements, Scanner, Object, Value, Message,
     Bloc, Bloc_Classe, Symbol, Text_Io, Bounded_String, Tiny_Error;
package body Primary is

    type Node_Structure is
        record
            Rule : Natural range 0 .. 4 := 0;
            Iden : Message.Tiny_String;
            Obj : Object.Reference := Object.Void_Reference;
            Val : Value.Node := Value.Empty_Node;
            Blk : Object.Reference := Object.Void_Reference;
        end record;

    procedure Parse (N : in out Node; Error : out Boolean) is
        Failed : Boolean := False;
        A_Bloc : Bloc.Node := Bloc.Empty_Node;
        use Scanner;
    begin
        Text_Io.Put_Line ("I am in primary.parse");
        N := new Node_Structure;
        case Scanner.Get_Token is
            when Scanner.T_Integer =>
                N.Rule := 0;
                N.Obj := Scanner.Get_Value;
            when Scanner.T_Identifier =>
                N.Rule := 1;
                N.Iden := Scanner.Get_Value;
            when Scanner.T_Parenthese_Open =>
                N.Rule := 2;
                Scanner.Next;
                Value.Parse (N.Val, Failed);
                if not Failed and Scanner.Get_Token /=
                                     Scanner.T_Parenthese_End then  
                    Failed := True;
                    Tiny_Error.Miss_Ending_Parenthese;
                end if;
            when Scanner.T_Bloc_Open =>
                N.Rule := 3;
                Bloc.Parse (A_Bloc, Failed);
                N.Blk := Bloc_Classe.Create (A_Bloc);
            when Scanner.T_String =>
                N.Rule := 4;
                N.Obj := Scanner.Get_Value;
            when others =>
                Failed := True;
        end case;
        Error := Failed;
    end Parse;


    function Interpret (N : Node) return Object.Reference is
        Result : Object.Reference;
    begin
        Text_Io.Put_Line ("I am in primary.interpret, rule " &
                          Integer'Image (N.Rule));
        case N.Rule is
            when 0 | 4 =>
                Result := N.Obj;  
            when 1 =>
                Result := Symbol.Eval (N.Iden);  
            when 2 =>
                Result := Value.Interpret (N.Val);
            when 3 =>
                Result := N.Blk;
        end case;
        return Result;
    end Interpret;
end Primary;