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

⟦b263aae17⟧ TextFile

    Length: 2628 (0xa44)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Value, Scanner, Object, Table, Message,
     Symbol, Text_Io, String_Classe, Bloc_Classe;
package body Expression is

    type Node_Structure is
        record
            Rule : Natural range 0 .. 1 := 0;
            Iden : Message.Tiny_String;  
            Val : Value.Node := Value.Empty_Node;
        end record;

    procedure Parse (N : in out Node; Error : out Boolean) is
        Failed : Boolean := False;  
        use Scanner;
    begin  
        Text_Io.Put_Line ("I am in expression.parse");
        N := new Node_Structure;
        if Is_First (Scanner.Get_Token) then
            if Scanner.Get_Token = Scanner.T_Pour then
                N.Rule := 0;
                Scanner.Next;
                N.Iden := Scanner.Get_Value;
                Scanner.Next;
                if Scanner.Get_Token = T_Prendre then
                    Scanner.Next;
                    Value.Parse (N.Val, Failed);
                else
                    Failed := True;
                    raise Prendre_Lacks;
                end if;
            else
                N.Rule := 1;
                Value.Parse (N.Val, Failed);
            end if;
        else
            Failed := True;
        end if;
        Error := Failed;
    end Parse;

    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        case T is
            when Scanner.T_Pour | Scanner.T_Integer |
                 Scanner.T_Identifier | Scanner.T_Parenthese_Open |
                 Scanner.T_Bloc_Open | Scanner.T_String =>
                return (Standard.True);
            when others =>
                return (Standard.False);
        end case;

    end Is_First;

    function Interpret (N : Node) return Object.Reference is
        Result, A_Object : Object.Reference;

    begin
        Text_Io.Put_Line ("I am in expression.interpret");
        case N.Rule is
            when 0 =>  
                A_Object := Symbol.Eval (N.Iden);
                case Object.Get_Classe (A_Object) is
                    when Object.String_Classe =>
                        String_Classe.Remove (A_Object);
                    when Object.Bloc_Classe =>
                        Bloc_Classe.Remove (A_Object);
                    when others =>
                        null;
                end case;
                Result := Value.Interpret (N.Val);
                Object.Copy (Source => Result, Target => A_Object);
                Symbol.Insert (N.Iden, A_Object);
            when 1 =>
                Result := Value.Interpret (N.Val);  
        end case;
        return Result;
    end Interpret;
end Expression;