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

⟦294ca3824⟧ TextFile

    Length: 2574 (0xa0e)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Arguments, Statements, Scanner, Object, Message, Table, Bug;
package body Block is

    type Node_Structure is
        record
            Arg : Arguments.Node := Arguments.Empty_Node;
            Stat : Statements.Node := Statements.Empty_Node;
            Id_List : Message.List;
            Keyword_List : Message.List;
            Symbol : Table.Symbol_Kind;
            Parent_Block : Node := Empty_Node;
            Line : Natural;
        end record;

    Current_Node : Node;


    function Current return Node is
    begin  
        return Current_Node;
    end Current;

    function Symbol (N : Node) return Table.Symbol_Kind is
    begin
        return N.Symbol;
    end Symbol;

    function Parent (N : Node) return Node is
    begin  
        return N.Parent_Block;
    end Parent;

    function Keyword_List (N : Node) return Message.List is
    begin
        return N.Keyword_List;
    end Keyword_List;

    function Identifier_List (N : Node) return Message.List is
    begin
        return N.Id_List;
    end Identifier_List;

    procedure Parse (N : in out Node) is
        use Scanner;
    begin  
        N := new Node_Structure;
        N.Line := Scanner.Get_Line_Number;
        N.Parent_Block := Current_Node;
        Current_Node := N;
        Message.Init (N.Keyword_List);
        Message.Init (N.Id_List);
        Table.Initialize (N.Symbol);
        Scanner.Next;
        Arguments.Parse (N.Arg, N.Keyword_List, N.Id_List, N.Symbol);
        Statements.Parse (N.Stat);
        if Scanner.Get_Token /= Scanner.T_Block_End then
            raise Bug.Missing_Right_Brace;
        end if;
        if N.Parent_Block /= Empty_Node then
            Current_Node := N.Parent_Block;
        end if;
    end Parse;

    procedure Unparse (N : in Node) is
    begin
        Scanner.Set_Line_Number (N.Line);
        Arguments.Unparse (N.Arg, N.Keyword_List, N.Id_List);
        Statements.Unparse (N.Stat);
    end Unparse;

    function Interpret (N : Node) return Object.Reference is
        Result : Object.Reference;
        Execution_Parent_Block_Node : Block.Node;
    begin  
        Scanner.Set_Line_Number (N.Line);
        Execution_Parent_Block_Node := Current_Node;
        Current_Node := N;  
        Result := Statements.Interpret (N.Stat, Result);
        Current_Node := Execution_Parent_Block_Node;
        return (Result);
    end Interpret;

begin
    Current_Node := new Node_Structure;
    Message.Init (Current_Node.Keyword_List);
    Message.Init (Current_Node.Id_List);
    Table.Initialize (Current_Node.Symbol);
end Block;