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 - metrics - download
Index: T V

⟦6c3e8e6e9⟧ TextFile

    Length: 19189 (0x4af5)
    Types: TextFile
    Names: »V«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

----------------------------------------------------------------------
with Host_Dependencies;  -- host dependent constants for the compiler.
with Grammar_Constants;  -- constants generated by parser generator
use Grammar_Constants;

package Parsetables is
    --| Table output of parse tables generator

    --| Overview
    --|
    --| This package contains the constants and tables generated by running
    --| the LALR(1) parse tables generator on the Ada Grammar.
    --| It also contains subprograms to access values in the more complex
    --| tables, that could have their structures tuned later.
    --|

    --| Tuning
    --|
    --| --------------------------------------------------------------
    --|
    --| The Parser Generator has two options that effect the speed of
    --| compilation:
    --|
    --| NODEFAULT : Eliminates the default reductions.
    --| This also would improve error recovery.
    --| Note that the table DefaultMap is still produced, though it
    --| will never be referenced.
    --| Thus, there need be no change to the code
    --| in ParserUtilities.GetAction .
    --|
    --| LF : This changes the load factor used to pack and size the
    --| ActionTables. It can range between 0 and 100.
    --| A low LF means fewer collisions and faster parsing.
    --| A high LF means more collisions and slower parsing.
    --| ----------------------------------------------------------------
    --|
    --| The types GrammarSymbolRecord and FollowSymbolRecord
    --| have a lot of unused space. The space/time tradeoff of
    --| converting these into discriminated records or another
    --| alternative representation, could be investigated.
    --| This investigation should take the elaboration time
    --| of the initializing aggregates into account.
    --|
    --| ----------------------------------------------------------------
    --|
    --| The Action Tables might be made made smaller by a restructuring of
    --| the grammar.
    --| For example: Have a rule for the token sequence:
    --|
    --| BEGIN seq_Of_Statements [EXCP..]
    --|
    --| ----------------------------------------------------------------
    --|
    --| The ParserGenerator might be modified along with
    --| ParseTables.GetAction to produce smaller tables.
    --| See:
    --|
    --| "Combined Actions to Reduce LR-Parsertables"
    --| by K.Groneing. SIGPLAN Notices, Volume 19, Number 3, March 1984.
    --|
    --| ----------------------------------------------------------------
    --|

    --| Notes
    --|
    --| Abbreviations Used
    --|
    --| Rep : Representation
    --|

    --| RUN-TIME INPUT OF NYU LALR GENERATED TABLES AND CONSTANTS
    --|
    --|
    --| followed by the current correct value of the
    --| constant supplied by the NYU LALR Parser Generator:
    --|
    --| GrammarSymbolCount
    --| LeftHandSideCount
    --| RightHandSideCount
    --| ActionTableOneLength
    --| ActionTableTwoLength
    --| DefaultMapLength
    --| InSymbolMapLength
    --| FollowMapLength
    --| StateCountPlusOne
    --| GrammarSymbolCountPlusOne
    --| ActionCount
    --| ActionTableSize
    --|
    --| in each of the eight declarations:
    --|
    --| GrammarSymbolTable
    --| LeftHandSide
    --| RightHandSide
    --| ActionTableOne
    --| ActionTableTwo
    --| DefaultMap
    --| InSymbolMap
    --| FollowSymbolMap
    --|

    package Gc renames Grammar_Constants;

    ------------------------------------------------------------------
    -- Common Declarations for Action_Token_Map
    ------------------------------------------------------------------

    Max_Action_Token_Count : constant := 48;
    --| This constant may need to be made larger if the grammar
    --| ever gets too large.
    --| It could be automatically generated.


    ------------------------------------------------------------------
    -- Common Declarations for Shift_State_Map
    ------------------------------------------------------------------

    Max_Shift_State_Count : constant := 90;
    --| This constant may need to be made larger if the grammar
    --| ever gets too large.
    --| It could be automatically generated.



    subtype Parserstringrangepluszerocommon is
       Natural range 0 .. Host_Dependencies.Maxcolumn;
    --| Parser's string should never be greater than a source line
    --| worth of text.

    subtype Grammarsymbolreprangepluszerocommon is
       Parserstringrangepluszerocommon range 0 .. 57;

    subtype Followsymbolrangecommon is Gc.Parserinteger range 1 .. 50;

    ------------------------------------------------------------------
    -- Declarations Global to Package ParseTables
    ------------------------------------------------------------------

    subtype Positiveparserinteger is Gc.Parserinteger
                                        range 1 .. Gc.Parserinteger'Last;

    subtype Parserstringrangepluszero is Parserstringrangepluszerocommon;
    --| Parser's string should never be greater than a source line
    --| worth of text.

    ----------------------------------------------------------------------
    -- The first constant used to  the Parse Tables
    ----------------------------------------------------------------------

    Grammarsymbolcount : constant Gc.Parserinteger := Gc.Setgrammarsymbolcount;
    --| Number of terminals and nonterminals in the Ada grammar
    --| rules input to the parse tables generator

    subtype Grammarsymbolrange is Gc.Parserinteger
                                     range 1 .. Grammarsymbolcount;
    --| valid range of values for grammar symbols

    ------------------------------------------------------------------
    -- Parser Table Generated Token Values for Terminals
    ------------------------------------------------------------------

    -- WARNING: need to be checked after each Parser Generator Run.
    -- This could be made part of the ParseTables/ErrorParseTables
    -- generator program(s) at some point.

    ------------------------------------------------------------------
    -- Special Empty Terminal
    ------------------------------------------------------------------

    Empty_Tokenvalue : constant Grammarsymbolrange := 1;

    ------------------------------------------------------------------
    -- Reserved Words
    ------------------------------------------------------------------

    Aborttokenvalue : constant Grammarsymbolrange := 2;
    Abstokenvalue : constant Grammarsymbolrange := 3;
    Accepttokenvalue : constant Grammarsymbolrange := 4;
    Accesstokenvalue : constant Grammarsymbolrange := 5;
    Alltokenvalue : constant Grammarsymbolrange := 6;
    Andtokenvalue : constant Grammarsymbolrange := 7;
    Arraytokenvalue : constant Grammarsymbolrange := 8;
    Attokenvalue : constant Grammarsymbolrange := 9;
    Begintokenvalue : constant Grammarsymbolrange := 10;
    Bodytokenvalue : constant Grammarsymbolrange := 11;
    Casetokenvalue : constant Grammarsymbolrange := 12;
    Constanttokenvalue : constant Grammarsymbolrange := 13;
    Declaretokenvalue : constant Grammarsymbolrange := 14;
    Delaytokenvalue : constant Grammarsymbolrange := 15;
    Deltatokenvalue : constant Grammarsymbolrange := 16;
    Digitstokenvalue : constant Grammarsymbolrange := 17;
    Dotokenvalue : constant Grammarsymbolrange := 18;
    Elsetokenvalue : constant Grammarsymbolrange := 19;
    Elsiftokenvalue : constant Grammarsymbolrange := 20;
    Endtokenvalue : constant Grammarsymbolrange := 21;
    Entrytokenvalue : constant Grammarsymbolrange := 22;
    Exceptiontokenvalue : constant Grammarsymbolrange := 23;
    Exittokenvalue : constant Grammarsymbolrange := 24;
    Fortokenvalue : constant Grammarsymbolrange := 25;
    Functiontokenvalue : constant Grammarsymbolrange := 26;
    Generictokenvalue : constant Grammarsymbolrange := 27;
    Gototokenvalue : constant Grammarsymbolrange := 28;
    Iftokenvalue : constant Grammarsymbolrange := 29;
    Intokenvalue : constant Grammarsymbolrange := 30;
    Istokenvalue : constant Grammarsymbolrange := 31;
    Limitedtokenvalue : constant Grammarsymbolrange := 32;
    Looptokenvalue : constant Grammarsymbolrange := 33;
    Modtokenvalue : constant Grammarsymbolrange := 34;
    Newtokenvalue : constant Grammarsymbolrange := 35;
    Nottokenvalue : constant Grammarsymbolrange := 36;
    Nulltokenvalue : constant Grammarsymbolrange := 37;
    Oftokenvalue : constant Grammarsymbolrange := 38;
    Ortokenvalue : constant Grammarsymbolrange := 39;
    Otherstokenvalue : constant Grammarsymbolrange := 40;
    Outtokenvalue : constant Grammarsymbolrange := 41;
    Packagetokenvalue : constant Grammarsymbolrange := 42;
    Pragmatokenvalue : constant Grammarsymbolrange := 43;
    Privatetokenvalue : constant Grammarsymbolrange := 44;
    Proceduretokenvalue : constant Grammarsymbolrange := 45;
    Raisetokenvalue : constant Grammarsymbolrange := 46;
    Rangetokenvalue : constant Grammarsymbolrange := 47;
    Recordtokenvalue : constant Grammarsymbolrange := 48;
    Remtokenvalue : constant Grammarsymbolrange := 49;
    Renamestokenvalue : constant Grammarsymbolrange := 50;
    Returntokenvalue : constant Grammarsymbolrange := 51;
    Reversetokenvalue : constant Grammarsymbolrange := 52;
    Selecttokenvalue : constant Grammarsymbolrange := 53;
    Separatetokenvalue : constant Grammarsymbolrange := 54;
    Subtypetokenvalue : constant Grammarsymbolrange := 55;
    Tasktokenvalue : constant Grammarsymbolrange := 56;
    Terminatetokenvalue : constant Grammarsymbolrange := 57;
    Thentokenvalue : constant Grammarsymbolrange := 58;
    Typetokenvalue : constant Grammarsymbolrange := 59;
    Usetokenvalue : constant Grammarsymbolrange := 60;
    Whentokenvalue : constant Grammarsymbolrange := 61;
    Whiletokenvalue : constant Grammarsymbolrange := 62;
    Withtokenvalue : constant Grammarsymbolrange := 63;
    Xortokenvalue : constant Grammarsymbolrange := 64;

    ------------------------------------------------------------------
    -- Identifier and Literals
    ------------------------------------------------------------------

    Identifiertokenvalue : constant Grammarsymbolrange := 65;
    Numerictokenvalue : constant Grammarsymbolrange := 66;
    Stringtokenvalue : constant Grammarsymbolrange := 67;
    Charactertokenvalue : constant Grammarsymbolrange := 68;

    ------------------------------------------------------------------
    -- Single Delimiters
    ------------------------------------------------------------------

    Ampersand_Tokenvalue : constant Grammarsymbolrange := 69;
    Apostrophe_Tokenvalue : constant Grammarsymbolrange := 70;
    Leftparen_Tokenvalue : constant Grammarsymbolrange := 71;
    Rightparen_Tokenvalue : constant Grammarsymbolrange := 72;
    Star_Tokenvalue : constant Grammarsymbolrange := 73;
    Plus_Tokenvalue : constant Grammarsymbolrange := 74;
    Comma_Tokenvalue : constant Grammarsymbolrange := 75;
    Minus_Tokenvalue : constant Grammarsymbolrange := 76;
    Dot_Tokenvalue : constant Grammarsymbolrange := 77;
    Slash_Tokenvalue : constant Grammarsymbolrange := 78;
    Colon_Tokenvalue : constant Grammarsymbolrange := 79;
    Semicolon_Tokenvalue : constant Grammarsymbolrange := 80;
    Lt_Tokenvalue : constant Grammarsymbolrange := 81;
    Eq_Tokenvalue : constant Grammarsymbolrange := 82;
    Gt_Tokenvalue : constant Grammarsymbolrange := 83;
    Bar_Tokenvalue : constant Grammarsymbolrange := 84;


    ------------------------------------------------------------------
    -- Double Delimiters
    ------------------------------------------------------------------

    Eqgt_Tokenvalue : constant Grammarsymbolrange := 85;
    Dotdot_Tokenvalue : constant Grammarsymbolrange := 86;
    Starstar_Tokenvalue : constant Grammarsymbolrange := 87;
    Coloneq_Tokenvalue : constant Grammarsymbolrange := 88;
    Slasheq_Tokenvalue : constant Grammarsymbolrange := 89;
    Gteq_Tokenvalue : constant Grammarsymbolrange := 90;
    Lteq_Tokenvalue : constant Grammarsymbolrange := 91;
    Ltlt_Tokenvalue : constant Grammarsymbolrange := 92;
    Gtgt_Tokenvalue : constant Grammarsymbolrange := 93;
    Ltgt_Tokenvalue : constant Grammarsymbolrange := 94;

    ------------------------------------------------------------------
    -- Comment Terminal
    ------------------------------------------------------------------

    Comment_Tokenvalue : constant Grammarsymbolrange := 95;

    ------------------------------------------------------------------
    -- Special Terminals
    ------------------------------------------------------------------

    Eof_Tokenvalue : constant Grammarsymbolrange := 96;

    ------------------------------------------------------------------
    -- Special Non-Terminals
    ------------------------------------------------------------------

    Acc_Tokenvalue : constant Grammarsymbolrange := 97;

    ------------------------------------------------------------------
    -- Grammar Symbol Classes
    ------------------------------------------------------------------

    subtype Tokenrange is Grammarsymbolrange range 1 .. Eof_Tokenvalue;

    subtype Tokenrangelesseof is Grammarsymbolrange
                                    range 1 .. (Eof_Tokenvalue - 1);

    subtype Nontokenrange is
       Grammarsymbolrange range (Eof_Tokenvalue + 1) .. Grammarsymbolcount;

    Actioncount : constant Gc.Parserinteger := Gc.Setactioncount;
    --| Number of actions in the parse tables.
    -- NYU Reference Name: NUM_ACTIONS

    Statecountplusone : constant Gc.Parserinteger := Gc.Setstatecountplusone;
    --| Number of states plus one in the parse tables.
    -- NYU Reference Name: NUM_STATES

    subtype Staterange is Gc.Parserinteger range 1 .. (Statecountplusone - 1);

    subtype Actionrange is Gc.Parserinteger range 0 .. Actioncount;

    Lefthandsidecount : constant Gc.Parserinteger := Gc.Setlefthandsidecount;
    --| Number of left hand sides in the Ada grammar rules.

    subtype Lefthandsiderange is Gc.Parserinteger range 1 .. Lefthandsidecount;

    function Get_Lefthandside (Grammarrule : in Lefthandsiderange)
                              return Grammarsymbolrange;
    pragma Inline (Get_Lefthandside);

    Righthandsidecount : constant Gc.Parserinteger := Gc.Setrighthandsidecount;
    --| Number of right hand sides in the Ada grammar rules.

    subtype Righthandsiderange is Gc.Parserinteger
                                     range 1 .. Righthandsidecount;

    function Get_Righthandside
                (Grammarrule : in Righthandsiderange) return Gc.Parserinteger;
    pragma Inline (Get_Righthandside);

    ------------------------------------------------------------------
    -- Subprogram Bodies Global to Package ParseTables
    ------------------------------------------------------------------

    function Getaction (Instatevalue : in Staterange;
                        Insymbolvalue : in Grammarsymbolrange)
                       return Actionrange;

    function Get_Grammar_Symbol
                ( --| return the string representation
                 --| of the grammar symbol
                 In_Index : in Grammarsymbolrange) return String;

    --| Effects
    --|
    --| This subprogram returns the string representation of the
    --| GrammarSymbolRange passed in.
    --|

    ------------------------------------------------------------------
    subtype Followmaprange is Nontokenrange;

    type Followsymbolarray is
       array (Positiveparserinteger range <>) of Grammarsymbolrange;

    type Followsymbolrecord is
        record
            Follow_Symbol_Count : Tokenrange;
            Follow_Symbol : Followsymbolarray (Tokenrange);
        end record;
    ------------------------------------------------------------------

    function Get_Follow_Map ( --| return the array of follow symbols
                             --| of the grammar symbol passed in
                             In_Index : in Followmaprange)
                            return Followsymbolrecord;


    --| Effects
    --|
    --| This subprogram returns the array of follow symbols for the
    --| grammar symbol passed in.
    --|

    ------------------------------------------------------------------
    -- The following declarations are for Error Recovery.
    ------------------------------------------------------------------
    ------------------------------------------------------------------
    -- Action_Token_Map
    ------------------------------------------------------------------

    subtype Action_Token_Range is Gc.Parserinteger
                                     range 1 .. Max_Action_Token_Count;

    subtype Action_Token_Range_Plus_Zero is
       Gc.Parserinteger range 0 .. Max_Action_Token_Count;
    --| for the set_size (which could be null!)

    type Action_Token_Array is
       array (Positiveparserinteger range <>) of Tokenrangelesseof;

    type Action_Token_Record is
        record
            Set_Size : Action_Token_Range_Plus_Zero;
            Set : Action_Token_Array (Action_Token_Range);
        end record;

    ------------------------------------------------------------------
    -- Shift_State_Map
    ------------------------------------------------------------------

    subtype Shift_State_Range is Gc.Parserinteger
                                    range 1 .. Max_Shift_State_Count;

    subtype Shift_State_Range_Plus_Zero is
       Gc.Parserinteger range 0 .. Max_Shift_State_Count;
    --| for the set_size (which could be null!)

    type Shift_State_Array is
       array (Positiveparserinteger range <>) of Staterange;

    type Shift_State_Record is
        record
            Set_Size : Shift_State_Range_Plus_Zero;
            Set : Shift_State_Array (Shift_State_Range);
        end record;

    ------------------------------------------------------------------

    function Get_Action_Token_Map ( --| return the array of action tokens
                                   --| for the state passed in.
                                   In_Index : in Staterange
                                   --| the state to return action tokens
                                   --| for.
                                   ) return Action_Token_Record;

    ------------------------------------------------------------------

    function Get_Shift_State_Map ( --| return the array of shift states
                                  --| for the grammar symbol passed in.
                                  In_Index : in Grammarsymbolrange
                                  --| grammar symbol to return shifts
                                  --| for.
                                  ) return Shift_State_Record;

    -- The following variables contain statistics information
    -- collected during the parse:
    Parserdecisioncount : Natural := 0;  --| Total number of times that
    --| GetAction was called.
    Maxcollisions : Natural := 0;  --| Of all the calls to GetAction
    --| The one which resulted in the greatest number of collisions
    Totalcollisions : Natural := 0;
    --| Total number of collisions which occurred during parsing.

end Parsetables;