Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

virtual_parse_stack Class Reference

List of all members.

Public Methods

 virtual_parse_stack (Stack shadowing_stack) throws java.lang.Exception
boolean empty ()
void pop () throws java.lang.Exception
void push (int state_num)
int top () throws java.lang.Exception

Protected Methods

void get_from_real ()

Protected Attributes

Stack real_stack
int real_next
Stack vstack

Detailed Description

This class implements a temporary or "virtual" parse stack that replaces the top portion of the actual parse stack (the part that has been changed by some set of operations) while maintaining its original contents. This data structure is used when the parse needs to "parse ahead" to determine if a given error recovery attempt will allow the parse to continue far enough to consider it successful. Once success or failure of parse ahead is determined the system then reverts to the original parse stack (which has not actually been modified). Since parse ahead does not execute actions, only parse state is maintained on the virtual stack, not full Symbol objects.

See also:
java_cup.runtime.lr_parser
Version:
last updated: 7/3/96
Author:
Frank Flannery

Definition at line 54 of file virtual_parse_stack.java.


Constructor & Destructor Documentation

virtual_parse_stack::virtual_parse_stack Stack   shadowing_stack [inline]
 

Constructor to build a virtual stack out of a real stack.

Definition at line 90 of file virtual_parse_stack.java.


Member Function Documentation

boolean virtual_parse_stack::empty   [inline]
 

Indicate whether the stack is empty.

Definition at line 108 of file virtual_parse_stack.java.

void virtual_parse_stack::get_from_real   [inline, protected]
 

Transfer an element from the real to the virtual stack. This assumes that the virtual stack is currently empty.

Definition at line 121 of file virtual_parse_stack.java.

Referenced by pop(), and virtual_parse_stack().

void virtual_parse_stack::pop   [inline]
 

Pop the stack.

Definition at line 140 of file virtual_parse_stack.java.

Referenced by lr_parser::try_parse_ahead().

void virtual_parse_stack::push int   state_num [inline]
 

Push a state number onto the stack.

Definition at line 156 of file virtual_parse_stack.java.

Referenced by lr_parser::try_parse_ahead().

int virtual_parse_stack::top   [inline]
 

Return value on the top of the stack (without popping it).

Definition at line 163 of file virtual_parse_stack.java.

Referenced by lr_parser::try_parse_ahead().


Member Data Documentation

int virtual_parse_stack::real_next [protected]
 

Top of stack indicator for where we leave off in the real stack. This is measured from top of stack, so 0 would indicate that no elements have been "moved" from the real to virtual stack.

Definition at line 71 of file virtual_parse_stack.java.

Stack virtual_parse_stack::real_stack [protected]
 

The real stack that we shadow. This is accessed when we move off the bottom of the virtual portion of the stack, but is always left unmodified.

Definition at line 63 of file virtual_parse_stack.java.

Stack virtual_parse_stack::vstack [protected]
 

The virtual top portion of the stack. This stack contains Integer objects with state numbers. This stack shadows the top portion of the real stack within the area that has been modified (via operations on the virtual stack). When this portion of the stack becomes empty we transfer elements from the underlying stack onto this stack.

Definition at line 81 of file virtual_parse_stack.java.


The documentation for this class was generated from the following file:
Generated at Thu Feb 7 07:22:55 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001