|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T V
Length: 5149 (0x141d)
Types: TextFile
Names: »V«
└─⟦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⟧
-- $Source: /nosc/work/parser/RCS/StateStk.spc,v $
-- $Revision: 4.0 $ -- $Date: 85/02/19 11:43:44 $ -- $Author: carol $
----------------------------------------------------------------------
with Parserdeclarations; -- declarations for the Parser
use Parserdeclarations;
package Statestack is
--| Elements awaiting parsing
--| Overview
--|
--| The StateStack used by the parser.
--|
--| This data structure has the following sets of operations:
--|
--| 1) A set that add and delete elements.
--| This set can raise the exceptions Underflow and Overflow.
--| The set includes:
--|
--| Pop
--| Push
--| Reduce
--|
--| 2) A function that returns the number of elements in the
--| data structure.
--| This set raises no exceptions.
--| The set includes:
--|
--| Length
--|
--| 3) A copy operations, to return the top of the stack.
--| The exception, UnderFlow,
--| is utilized to indicate the end of a sequential examination.
--| The set includes:
--|
--| CopyTop
--| InitCopy
--| CopyNext
--| Notes
--|
--| Under some implementations the exception
--| ParserDeclarations.MemoryOverflow could be raised.
--|
------------------------------------------------------------------
-- Declarations Global to Package StateStack
------------------------------------------------------------------
Overflow : exception;
--| raised if no more space in stack.
Underflow : exception;
--| raised if no more elements in stack.
------------------------------------------------------------------
procedure Push ( --| Adds new top element to stack
Element : in Statestackelement); --| element to add
--|
--| Raises
--|
--| OverFlow - no more space in stack.
--| Effects
--|
--| This subprogram adds an element to the top of the stack.
--|
------------------------------------------------------------------
function Pop return Statestackelement; --| Removes top element in stack
--| Raises
--|
--| UnderFlow - no more elements in stack.
--| Effects
--|
--| This subprogram pops the element at the top of the stack.
--|
------------------------------------------------------------------
function Copytop return Statestackelement;
--| Copy top element in stack
--| Raises
--|
--| UnderFlow - no more elements in stack.
--|
--| Effects
--|
--| Returns the top of the stack.
------------------------------------------------------------------
function Copynext return Statestackelement;
--| Copy element after previous one copied
--| Raises
--|
--| UnderFlow - no more elements in stack.
--| Effects
--|
--| This subprogram is used in conjunction with
--| CopyTop or Init Copy to sequentially examine the stack.
--|
------------------------------------------------------------------
function Length return Stateparsestacksindex;
--| Returns the number of elements in the stack
--| Effects
--|
--| This subprogram returns the number of elements in the stack.
--|
------------------------------------------------------------------
procedure Initcopy; --| Initialize sequential examination of
--| the data structure
--| Effects
--|
--| Initializes the copy function,
--| so that subsequent calls to CopyNext will sequentially examine
--| the elements in the data structure.
--|
------------------------------------------------------------------
function Copythisone ( --| returns element given by parm 'which_one'
Which_One : in Stateparsestacksrange)
return Statestackelement;
--| Overview
--|
--| Returns the state stack element indicated by the parameter
--| 'which_one'. This operation is needed by LocalStateStack
--| because, in essence, the state stack is being copied in two
--| nested loops and the Next_To_Copy counter can therefore only
--| be used for one of the series of copies.
------------------------------------------------------------------
procedure Reduce ( --| Pops and discards top n elements on
--| the stack.
Topn : in Stateparsestacksindex);
--| Number of elements to pop.
--| Raises:
--|
--| Underflow - no more elements in stack.
--| Effects
--|
--| Pops and discards TopN elements on the stack.
--| If TopN is greater than the number of elements in the stack,
--| Underflow is raised.
--| This subprogram is used by the parser to reduce the stack during
--| a reduce action.
--| This stack reduction could be done with a for
--| loop and the Pop subprogram at a considerable cost in execution
--| time.
--|
------------------------------------------------------------------
end Statestack;
----------------------------------------------------------------------