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

⟦4d5e836cc⟧ TextFile

    Length: 3043 (0xbe3)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Scanner;
with Object;
with Symbols;
with Arguments, Statements;
with Class_Block;
with Bounded_String;

package body Block is

    type Node_Structure is
        record
            Table : Symbols.Table := Symbols.Create;
            Kwd : Object.Unary;
            Ident : Object.Unary;
            Stat : Statements.Node := Statements.Empty_Node;
            Parent : Block.Node := Block.Empty_Node;
        end record;

    Current_Node : Block.Node;

    Ghost : Object.Reference;

    function Get_Ident (N : Node) return Object.Unary is
    begin
        return N.Ident;
    end Get_Ident;

    function Get_Kwd (N : Node) return Object.Unary is
    begin
        return N.Kwd;
    end Get_Kwd;

    function Get_Table (N : Node) return Symbols.Table is
    begin
        return N.Table;
    end Get_Table;

    procedure Put_Table (This_Object : Object.Reference;
                         Named : Object.Tiny_String;
                         Into : in out Node) is
    begin
        Symbols.Put (This_Object, Named, Into.Table);
    end Put_Table;

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

    function Get_Current_Table return Symbols.Table is
    begin
        return Current_Node.Table;
    end Get_Current_Table;

    procedure Put_Current_Table (This_Object : Object.Reference;
                                 Named : Object.Tiny_String) is
    begin
        Symbols.Put (This_Object, Named, Current_Node.Table);
    end Put_Current_Table;

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

    function Is_Nil (N : Node) return Boolean is
    begin
        return N = Empty_Node;
    end Is_Nil;

    procedure Parse (N : in out Node; Error : out Boolean) is
        Failed : Boolean := False;
    begin  
        N := new Node_Structure;
        N.Parent := Current_Node;
        Current_Node := N;
        if Bounded_String.Image (Scanner.Get_Value) = "{" then
            Scanner.Next;  
            Arguments.Parse (N, N.Ident, N.Kwd, Failed);
            if not Failed then
                Statements.Parse (N.Stat, Failed);
                if not Failed and then
                   Bounded_String.Image (Scanner.Get_Value) = "}" then
                    Scanner.Next;
                end if;
            end if;
            Current_Node := N.Parent;
        end if;
        Error := Failed;
    end Parse;

    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        return T = Special;
    end Is_First;

    function Interpret (N : Node) return Object.Reference is
        Result : Object.Reference := Object.Void_Reference;
        Node : Block.Node := Block.Current_Node;
    begin  
        Current_Node := N;
        Result := Statements.Interpret (N.Stat);
        Current_Node := Node;
        return Result;
    end Interpret;

begin
    Current_Node := new Node_Structure;

    Ghost := Class_Block.Create (Block.Get_Current_Node);

end Block;