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

⟦d656a096d⟧ TextFile

    Length: 17376 (0x43e0)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Debug;
with Lex;
with Symbol;
with Text_Io;
package body Parse is

    procedure Body_Description;
    procedure Description_List;

    procedure Error is
    begin
        Text_Io.Put ("Error ...");
        Text_Io.Put_Line (" ");
    end Error;


    procedure Value is
    begin
        case Lex.Get is
            when Lex.Identifier =>
                Lex.Next;
            when Lex.Int =>
                Lex.Next;  
            when Lex.Hour =>
                Lex.Next;
            when others =>
                Error;
        end case;
    end Value;


    procedure Factor;


    procedure Term is
    begin
        Factor;
        while Lex.Current_Token_Is (Lex.Multiply) loop
            Lex.Next;
            Factor;
        end loop;
    end Term;


    procedure Expression is  
        use Lex;
    begin
        Term;
        while (Lex.Current_Token_In ((Lex.Plus, Lex.Minus))) loop
            case Lex.Get is
                when Lex.Plus =>
                    Lex.Next;
                    Term;
                when Lex.Minus =>
                    Lex.Next;
                    Term;  
                when others =>
                    Error;
            end case;
        end loop;  
    end Expression;



    procedure Factor is
    begin  
        if Lex.Current_Token_Is (Lex.Open_Bracket) then
            Lex.Next;
            Expression;
            if Lex.Current_Token_Is (Lex.Close_Bracket) then
                Lex.Next;
            else
                Error;
            end if;
        else
            Value;
        end if;
    end Factor;

    procedure Relational_Operator is
    begin  
        if Lex.Current_Token_In ((Lex.Less_Than, Lex.Greater_Than,
                                  Lex.Less_Or_Equal, Lex.Greater_Or_Equal,
                                  Lex.Equal, Lex.Not_Equal)) then
            Lex.Next;
        else
            Error;
        end if;
    end Relational_Operator;

    procedure Condition is
    begin
        Value;
        Relational_Operator;
        Value;
    end Condition;

    procedure Liste_Value is
    begin
        Value;
        if Lex.Current_Token_In ((Lex.Temps, Lex.Int, Lex.Identifier)) then
            Liste_Value;
        end if;
    end Liste_Value;

    procedure Call_Sub_Routine is
    begin
        if Lex.Current_Token_Is (Lex.Executer) then
            Lex.Next;
            if Lex.Current_Token_Is (Lex.Identifier) then
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Avec) then
                    Lex.Next;
                    if Lex.Current_Token_Is (Lex.Open_Bracket) then
                        Lex.Next;
                        Liste_Value;
                        if Lex.Current_Token_Is (Lex.Close_Bracket) then
                            Lex.Next;
                        else
                            Error;
                        end if;
                    else
                        Error;
                    end if;
                end if;
            else
                Error;
            end if;
        end if;
    end Call_Sub_Routine;

    procedure Affect is
    begin
        if Lex.Current_Token_Is (Lex.Identifier) then
            Lex.Next;
            if Lex.Current_Token_Is (Lex.Let) then
                Lex.Next;
                Expression;
            else
                Error;
            end if;  
        else
            Error;
        end if;
    end Affect;

    procedure Primitives is
    begin
        case Lex.Get is
            when Lex.Activer =>
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Identifier) then
                    Lex.Next;
                else
                    Error;
                end if;
            when Lex.Desactiver =>
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Identifier) then
                    Lex.Next;
                else
                    Error;
                end if;
            when Lex.Fixer =>  
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Identifier) then
                    Lex.Next;
                    if Lex.Current_Token_Is (Lex.A) then
                        Lex.Next;
                        Value;
                    else
                        Error;
                    end if;
                end if;  
            when Lex.Evoluer =>
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Identifier) then
                    Lex.Next;
                    if Lex.Current_Token_Is (Lex.En) then
                        Lex.Next;
                        Value;
                        if Lex.Current_Token_Is (Lex.A) then
                            Lex.Next;
                            Value;
                        end if;  
                    else
                        Error;
                    end if;  
                else
                    Error;
                end if;
            when others =>
                Error;
        end case;
    end Primitives;

    procedure Primitives_List is
    begin
        Primitives;
        if Lex.Current_Token_In ((Lex.Activer, Lex.Desactiver,
                                  Lex.Fixer, Lex.Evoluer)) then
            Primitives_List;
        end if;
    end Primitives_List;

    procedure Action is
    begin  
        case Lex.Get is
            when Lex.Attendre =>
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Identifier) then
                    Lex.Next;
                end if;  
            when Lex.Pour =>
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Identifier) then
                    Lex.Next;
                    if Lex.Current_Token_Is (Lex.Faire) then
                        Lex.Next;
                        if Lex.Current_Token_Is (Lex.Open_Bracket) then
                            Lex.Next;
                            Primitives_List;
                            if Lex.Current_Token_Is (Lex.Close_Bracket) then
                                Lex.Next;
                            else
                                Error;
                            end if;  
                        else
                            Error;
                        end if;  
                    else
                        Lex.Next;
                        Primitives;
                    end if;
                end if;  
            when Lex.Puis =>
                Lex.Next;
                Body_Description;
            when Lex.Au =>
                if Lex.Current_Token_Is (Lex.Temps) then
                    Lex.Next;
                    Value;
                    if Lex.Current_Token_Is (Lex.Faire) then
                        Lex.Next;
                        Description_List;
                    else
                        Error;
                    end if;  
                else
                    Error;
                end if;  
            when others =>
                Error;
        end case;
    end Action;

    procedure While_Structure is
    begin
        if Lex.Current_Token_Is (Lex.Tant) then
            Lex.Next;
            if Lex.Current_Token_Is (Lex.Que) then
                Lex.Next;
                Condition;
                if Lex.Current_Token_Is (Lex.Faire) then
                    Lex.Next;
                    Description_List;
                    if Lex.Current_Token_Is (Lex.Fin) then
                        Lex.Next;
                        if Lex.Current_Token_Is (Lex.Tant) then
                            Lex.Next;
                            if Lex.Current_Token_Is (Lex.Que) then
                                Lex.Next;
                            else
                                Error;
                            end if;  
                        else
                            Error;
                        end if;  
                    else
                        Error;
                    end if;
                else
                    Error;
                end if;  
            else
                Error;
            end if;  
        end if;
    end While_Structure;

    procedure Case_List is
    begin
        Value;
        if Lex.Current_Token_Is (Lex.Faire) then
            Lex.Next;
            Body_Description;
            if Lex.Current_Token_In ((Lex.Temps, Lex.Int, Lex.Identifier)) then
                Case_List;
            end if;  
        else
            Error;
        end if;
    end Case_List;

    procedure Case_Structure is
    begin
        if Lex.Current_Token_Is (Lex.Selon) then
            Lex.Next;
            if Lex.Current_Token_Is (Lex.Identifier) then
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Est) then
                    Lex.Next;
                    Case_List;
                    if Lex.Current_Token_Is (Lex.Fin) then
                        Lex.Next;
                        if Lex.Current_Token_Is (Lex.Selon) then
                            Lex.Next;
                        else
                            Error;
                        end if;  
                    else
                        Error;
                    end if;  
                else
                    Error;
                end if;  
            else
                Error;
            end if;
        end if;
    end Case_Structure;


    procedure Liste is
    begin
        while not Lex.Current_Token_Is (Lex.End_Bracket) loop
            Affect;
        end loop;
    end Liste;

    procedure Body_Description is
    begin
        if Lex.Current_Token_Is (Lex.Begin_Bracket) then
            Debug.Put (40);
            Lex.Next;
            Description_List;
            if Lex.Current_Token_Is (Lex.End_Bracket) then
                Debug.Put (41);
                Lex.Next;
            else
                Error;
            end if;
        end if;
    end Body_Description;

    procedure Description_List is
    begin
        --Body_Description;
        if Lex.Current_Token_In ((Lex.Si, Lex.Selon, Lex.Tant,
                                  Lex.Attendre, Lex.Pour, Lex.Puis, Lex.Au,
                                  Lex.Identifier, Lex.Executer)) then
            Lex.Next;
            Description_List;
        end if;
    end Description_List;

    procedure If_Struct is
    begin
        if Lex.Current_Token_Is (Lex.Si) then
            Lex.Next;
            Condition;
            if Lex.Current_Token_Is (Lex.Alors) then
                Lex.Next;
                Description_List;
                if Lex.Current_Token_Is (Lex.Sinon) then
                    Description_List;
                    if Lex.Current_Token_Is (Lex.Fin) then
                        Lex.Next;
                        if Lex.Current_Token_Is (Lex.Si) then
                            Lex.Next;
                        else
                            Error;
                        end if;
                    else
                        Error;
                    end if;
                else
                    Error;
                end if;
            end if;
        end if;
    end If_Struct;


    procedure Control_Struct is
    begin
        case Lex.Get is
            when Lex.Si =>
                If_Struct;
            when Lex.Selon =>
                Case_Structure;
            when Lex.Tant =>
                While_Structure;
            when Lex.Attendre | Lex.Pour | Lex.Puis | Lex.Au =>
                Action;
            when Lex.Identifier =>
                Affect;
            when Lex.Executer =>
                Call_Sub_Routine;
            when others =>
                Error;
        end case;
    end Control_Struct;

    procedure Spectacle_Definition is
    begin
        Body_Description;
    end Spectacle_Definition;


    procedure List_Identifier is
    begin
        Lex.Next;
        if Lex.Current_Token_Is (Lex.Identifier) then
            List_Identifier;
        end if;
    end List_Identifier;


    procedure Parameter is
    begin
        if Lex.Current_Token_Is (Lex.Qui) then
            Lex.Next;
            Debug.Put (32);
            if Lex.Current_Token_Is (Lex.Utilise) then
                Lex.Next;
                Debug.Put (33);
            else
                Error;
            end if;
        else
            Error;
        end if;
    end Parameter;

    procedure Sub_Routine_Definition is
    begin
        Debug.Put (30);
        if Lex.Current_Token_Is (Lex.Identifier) then
            Lex.Next;
            Debug.Put (31);
            Parameter;
            if Lex.Current_Token_Is (Lex.Identifier) then
                Debug.Put (34);
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Est) then
                    Debug.Put (34);
                    Lex.Next;
                    Body_Description;
                    if Lex.Current_Token_Is (Lex.Identifier) then
                        Debug.Put (35);
                        Sub_Routine_Definition;
                    end if;
                else
                    Error;
                end if;
            else
                Error;
            end if;
        else
            Error;
        end if;
    end Sub_Routine_Definition;


    procedure Spectacle_Description is
    begin
        Sub_Routine_Definition;
        Spectacle_Definition;
    end Spectacle_Description;


    procedure Address is
    begin
        if Lex.Current_Token_Is (Lex.Int) then
            Debug.Put (16);
            Lex.Next;
        end if;
        if Lex.Current_Token_Is (Lex.Based) then
            Debug.Put (17);
            Lex.Next;
        end if;
    end Address;

    procedure Theater_Description is
    begin
        if Lex.Current_Token_Is (Lex.Identifier) then
            Debug.Put (12);
--

            Lex.Next;
            if Lex.Current_Token_Is (Lex.Est) then
                Debug.Put (13);
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Identifier) then
                    Debug.Put (14);
                    Lex.Next;
                    if Lex.Current_Token_Is (Lex.En) then
                        Debug.Put (15);
                        Lex.Next;
                        Address;
                        if Lex.Current_Token_Is (Lex.Identifier) then
                            Theater_Description;
                        end if;
                    else
                        Error;
                    end if;
                else
                    Error;
                end if;
            else
                Error;
            end if;
        end if;
    end Theater_Description;


    procedure Actor_Type is
    begin
        case Lex.Get is
            when Lex.Binaire =>
                Lex.Next;
            when Lex.Fugitif =>
                Lex.Next;
            when Lex.Discret =>
                Lex.Next;
            when Lex.Temporel =>
                Lex.Next;
            when others =>
                Error;
        end case;
    end Actor_Type;

    procedure Actor_List is
    begin
        if Lex.Current_Token_Is (Lex.Identifier) then
--
            Symbol.Add_Actor (Lex.Image, Symbol.No_Type);
            Lex.Next;
            Actor_Type;
            if Lex.Current_Token_Is (Lex.Identifier) then
                Actor_List;
            end if;
        end if;
    end Actor_List;


    procedure Material_Description is
    begin
        Debug.Put (1);
        if Lex.Current_Token_Is (Lex.Identifier) then
            Debug.Put (3);
--
            Symbol.Add_Material (Lex.Image);
            Lex.Next;
            if Lex.Current_Token_Is (Lex.Sait) then
                Debug.Put (4);
                Lex.Next;
                if Lex.Current_Token_Is (Lex.Faire) then
                    Debug.Put (5);
                    Lex.Next;
                    if Lex.Current_Token_Is (Lex.Begin_Bracket) then
                        Debug.Put (6);
                        Lex.Next;
                        Actor_List;
                        if Lex.Current_Token_Is (Lex.End_Bracket) then
                            Debug.Put (7);
                            Lex.Next;
                            if Lex.Current_Token_Is (Lex.Identifier) then
                                Material_Description;
                            end if;
                        else
                            Error;
                        end if;
                    else
                        Error;
                    end if;
                else
                    Error;
                end if;
            else
                Error;
            end if;
        end if;
    end Material_Description;

    procedure Shownet_File is
    begin
        if Lex.Current_Token_Is (Lex.Materiel) then
            Lex.Next;
            Material_Description;  
        else
            Error;
        end if;

        if Lex.Current_Token_Is (Lex.Theatre) then
            Debug.Put (10);
            Lex.Next;
            Theater_Description;  
        else
            Debug.Put (11);
            Error;
        end if;

        if Lex.Current_Token_Is (Lex.Spectacle) then
            Debug.Put (20);
            Lex.Next;
            Spectacle_Description;  
        else  
            Debug.Put (21);
            Error;
        end if;
    end Shownet_File;

    procedure Start is
    begin
        Lex.Next;
        Shownet_File;
    end Start;

end Parse;